Skip to content

Commit 20a1c67

Browse files
committed
Update default config for devise 4.6
Nothing changed, just updated to keeop up with the defaults.
1 parent 4523002 commit 20a1c67

1 file changed

Lines changed: 62 additions & 28 deletions

File tree

lib/generators/alchemy/devise/install/templates/devise.rb.tt

Lines changed: 62 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1+
# frozen_string_literal: true
2+
13
# Use this hook to configure devise mailer, warden hooks and so forth.
24
# Many of these configuration options can be set straight in your model.
35
Devise.setup do |config|
46
# The secret key used by Devise. Devise uses this key to generate
57
# random tokens. Changing this key will render invalid all existing
68
# confirmation, reset password and unlock tokens in the database.
9+
# Devise will use the `secret_key_base` as its `secret_key`
10+
# by default. You can change it below and use your own secret key.
11+
# config.secret_key = '<%= SecureRandom.hex(64) %>'
712

8-
# By default, Devise will use your Application's secret_key_base as its
9-
# secret_key. You can override it here by uncommenting the following
10-
# line. Remember to keep this file out of source control if you do that.
11-
# config.secret_key = <%= SecureRandom.hex(50).inspect %>
13+
# ==> Controller configuration
14+
# Configure the parent class to the devise controllers.
15+
config.parent_controller = "Alchemy::BaseController"
1216

1317
# ==> Mailer Configuration
1418
# Configure the e-mail address which will be shown in Devise::Mailer,
@@ -19,14 +23,15 @@ Devise.setup do |config|
1923
# Configure the class responsible to send e-mails.
2024
config.mailer = "Alchemy::Notifications"
2125

26+
# Configure the parent class responsible to send e-mails.
27+
# config.parent_mailer = 'ActionMailer::Base'
28+
2229
# ==> ORM configuration
2330
# Load and configure the ORM. Supports :active_record (default) and
2431
# :mongoid (bson_ext recommended) by default. Other ORMs may be
2532
# available as additional gems.
2633
require 'devise/orm/active_record'
2734

28-
config.parent_controller = "Alchemy::BaseController"
29-
3035
# ==> Configuration for any authentication mechanism
3136
# Configure which keys are used when authenticating a user. The default is
3237
# just :email. You can configure it to use [:username, :subdomain], so for
@@ -91,26 +96,41 @@ Devise.setup do |config|
9196
# from the server. You can disable this option at your own risk.
9297
# config.clean_up_csrf_token_on_authentication = true
9398

99+
# When false, Devise will not attempt to reload routes on eager load.
100+
# This can reduce the time taken to boot the app but if your application
101+
# requires the Devise mappings to be loaded during boot time the application
102+
# won't boot properly.
103+
# config.reload_routes = true
104+
94105
# ==> Configuration for :database_authenticatable
95-
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
96-
# using other encryptors, it sets how many times you want the password re-encrypted.
106+
# For bcrypt, this is the cost for hashing the password and defaults to 11. If
107+
# using other algorithms, it sets how many times you want the password to be hashed.
97108
#
98109
# Limiting the stretches to just one in testing will increase the performance of
99110
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
100111
# a value less than 10 in other environments. Note that, for bcrypt (the default
101-
# encryptor), the cost increases exponentially with the number of stretches (e.g.
112+
# algorithm), the cost increases exponentially with the number of stretches (e.g.
102113
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
103-
config.stretches = Rails.env.test? ? 1 : 10
114+
config.stretches = Rails.env.test? ? 1 : 11
115+
116+
# Set up a pepper to generate the hashed password.
117+
# config.pepper = '<%= SecureRandom.hex(64) %>'
118+
119+
# Send a notification to the original email when the user's email is changed.
120+
# config.send_email_changed_notification = false
104121

105-
# Setup a pepper to generate the encrypted password.
106-
# config.pepper = <%= SecureRandom.hex(50).inspect %>
122+
# Send a notification email when the user's password is changed.
123+
# config.send_password_change_notification = false
107124

108125
# ==> Configuration for :confirmable
109126
# A period that the user is allowed to access the website even without
110127
# confirming their account. For instance, if set to 2.days, the user will be
111128
# able to access the website for two days without confirming their account,
112-
# access will be blocked just in the third day. Default is 0.days, meaning
113-
# the user cannot access the website without confirming their account.
129+
# access will be blocked just in the third day.
130+
# You can also set it to nil, which will allow the user to access the website
131+
# without confirming their account.
132+
# Default is 0.days, meaning the user cannot access the website without
133+
# confirming their account.
114134
# config.allow_unconfirmed_access_for = 2.days
115135

116136
# A period that the user is allowed to confirm their account before their
@@ -128,7 +148,7 @@ Devise.setup do |config|
128148
config.reconfirmable = false
129149

130150
# Defines which key will be used when confirming an account
131-
# config.confirmation_keys = [ :email ]
151+
# config.confirmation_keys = [:email]
132152

133153
# ==> Configuration for :rememberable
134154
# The time the user will be remembered without asking for credentials again.
@@ -151,24 +171,21 @@ Devise.setup do |config|
151171
# Email regex used to validate email formats. It simply asserts that
152172
# one (and only one) @ exists in the given string. This is mainly
153173
# to give user feedback and not to assert the e-mail validity.
154-
# config.email_regexp = /\A[^@]+@[^@]+\z/
174+
config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
155175

156176
# ==> Configuration for :timeoutable
157177
# The time you want to timeout the user session without activity. After this
158178
# time the user will be asked for credentials again. Default is 30 minutes.
159179
config.timeout_in = Rails.env.development? ? nil : Alchemy::Config.get(:auto_logout_time).minutes
160180

161-
# If true, expires auth token on session timeout.
162-
# config.expire_auth_token_on_timeout = false
163-
164181
# ==> Configuration for :lockable
165182
# Defines which strategy will be used to lock an account.
166183
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
167184
# :none = No lock strategy. You should handle locking by yourself.
168185
# config.lock_strategy = :failed_attempts
169186

170187
# Defines which key will be used when locking and unlocking an account
171-
# config.unlock_keys = [ :email ]
188+
# config.unlock_keys = [:email]
172189

173190
# Defines which strategy will be used to unlock an account.
174191
# :email = Sends an unlock link to the user email
@@ -185,24 +202,28 @@ Devise.setup do |config|
185202
# config.unlock_in = 1.hour
186203

187204
# Warn on the last attempt before the account is locked.
188-
config.last_attempt_warning = true
205+
# config.last_attempt_warning = true
189206

190207
# ==> Configuration for :recoverable
191208
#
192209
# Defines which key will be used when recovering the password for an account
193-
# config.reset_password_keys = [ :email ]
210+
# config.reset_password_keys = [:email]
194211

195212
# Time interval you can reset your password with a reset password key.
196213
# Don't put a too small interval or your users won't have the time to
197214
# change their passwords.
198215
config.reset_password_within = 6.hours
199216

217+
# When set to false, does not sign a user in automatically after their password is
218+
# reset. Defaults to true, so a user is signed in automatically after a reset.
219+
# config.sign_in_after_reset_password = true
220+
200221
# ==> Configuration for :encryptable
201-
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
202-
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
203-
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
204-
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
205-
# REST_AUTH_SITE_KEY to pepper).
222+
# Allow you to use another hashing or encryption algorithm besides bcrypt (default).
223+
# You can use :sha1, :sha512 or algorithms from others authentication tools as
224+
# :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
225+
# for default behavior) and :restful_authentication_sha1 (then you should set
226+
# stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
206227
#
207228
# Require the `devise-encryptable` gem when using anything other than bcrypt
208229
# config.encryptor = :sha512
@@ -259,7 +280,20 @@ Devise.setup do |config|
259280
# The router that invoked `devise_for`, in the example above, would be:
260281
# config.router_name = :my_engine
261282
#
262-
# When using omniauth, Devise cannot automatically set Omniauth path,
283+
# When using OmniAuth, Devise cannot automatically set OmniAuth path,
263284
# so you need to do it manually. For the users scope, it would be:
264285
# config.omniauth_path_prefix = '/my_engine/users/auth'
286+
287+
# ==> Turbolinks configuration
288+
# If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly:
289+
#
290+
# ActiveSupport.on_load(:devise_failure_app) do
291+
# include Turbolinks::Controller
292+
# end
293+
294+
# ==> Configuration for :registerable
295+
296+
# When set to false, does not sign a user in automatically after their password is
297+
# changed. Defaults to true, so a user is signed in automatically after changing a password.
298+
# config.sign_in_after_change_password = true
265299
end

0 commit comments

Comments
 (0)