diff --git a/config/environments/development.rb b/config/environments/development.rb
index 8803494..a7e5631 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -34,9 +34,12 @@ Rails.application.configure do
# (see config/storage.yml for options).
config.active_storage.service = :local
- # Don't care if the mailer can't send.
- config.action_mailer.raise_delivery_errors = false
-
+ # When mail is sent from your application,
+ # Letter Opener will open a preview in the browser instead of sending.
+ config.action_mailer.delivery_method = :letter_opener
+ config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
+ config.action_mailer.perform_deliveries = true
+ config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_caching = false
# Print deprecation notices to the Rails logger.
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 2f3f972..7fdac4c 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -34,12 +34,12 @@ Rails.application.configure do
# Store uploaded files on the local file system in a temporary directory
config.active_storage.service = :test
- config.action_mailer.perform_caching = false
-
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
+ config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
+ config.action_mailer.perform_caching = false
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
index 8fc378c..249c016 100644
--- a/config/initializers/devise.rb
+++ b/config/initializers/devise.rb
@@ -132,7 +132,7 @@ Devise.setup do |config|
# able to access the website for two days without confirming their account,
# access will be blocked just in the third day. Default is 0.days, meaning
# the user cannot access the website without confirming their account.
- # config.allow_unconfirmed_access_for = 2.days
+ config.allow_unconfirmed_access_for = 0.days
# A period that the user is allowed to confirm their account before their
# token becomes invalid. For example, if set to 3.days, the user can confirm
@@ -140,7 +140,7 @@ Devise.setup do |config|
# their account can't be confirmed with the token any more.
# Default is nil, meaning there is no restriction on how long a user can take
# before confirming their account.
- # config.confirm_within = 3.days
+ config.confirm_within = 3.days
# If true, requires any email changes to be confirmed (exactly the same way as
# initial account confirmation) to be applied. Requires additional unconfirmed_email
@@ -149,7 +149,7 @@ Devise.setup do |config|
config.reconfirmable = true
# Defines which key will be used when confirming an account
- # config.confirmation_keys = [:email]
+ config.confirmation_keys = [:email]
# ==> Configuration for :rememberable
# The time the user will be remembered without asking for credentials again.
diff --git a/config/routes.rb b/config/routes.rb
index a3ac3c2..38d1afb 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -24,6 +24,7 @@ Rails.application.routes.draw do
devise_for :users, controllers: {
sessions: 'users/sessions',
registrations: 'users/registrations',
+ confirmations: 'users/confirmations',
}
resources :membership_applications, only: %i[new create]
diff --git a/factories/users.rb b/factories/users.rb
index 6c98ac9..dc14bcc 100644
--- a/factories/users.rb
+++ b/factories/users.rb
@@ -5,5 +5,9 @@ FactoryBot.define do
email { Faker::Internet.email }
password { Faker::Internet.password }
password_confirmation { password }
+
+ after :create do |user, _evaluator|
+ user.confirm
+ end
end
end