|
1
|
+# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+# frozen_string_literal: true
|
|
4
|
+
|
|
5
|
+# Assuming you have not yet modified this file, each configuration option below
|
|
6
|
+# is set to its default value. Note that some are commented out while others
|
|
7
|
+# are not: uncommented lines are intended to protect your configuration from
|
|
8
|
+# breaking changes in upgrades (i.e., in the event that future versions of
|
|
9
|
+# Devise change the default values for those options).
|
|
10
|
+#
|
|
11
|
+# Use this hook to configure devise mailer, warden hooks and so forth.
|
|
12
|
+# Many of these configuration options can be set straight in your model.
|
|
13
|
+Devise.setup do |config|
|
|
14
|
+ # The secret key used by Devise. Devise uses this key to generate
|
|
15
|
+ # random tokens. Changing this key will render invalid all existing
|
|
16
|
+ # confirmation, reset password and unlock tokens in the database.
|
|
17
|
+ # Devise will use the `secret_key_base` as its `secret_key`
|
|
18
|
+ # by default. You can change it below and use your own secret key.
|
|
19
|
+ # rubocop:todo Layout/LineLength
|
|
20
|
+ # config.secret_key = '7d8e38a5fab0957a46e4216f9ad7f815b633b51ba6586eefe59144df2746a5aa2a1a8b0093892052a9ccc90e70e0703bdac02bb596b2cdb87c70bec4dc51f5b6'
|
|
21
|
+ # rubocop:enable Layout/LineLength
|
|
22
|
+
|
|
23
|
+ # ==> Controller configuration
|
|
24
|
+ # Configure the parent class to the devise controllers.
|
|
25
|
+ # config.parent_controller = 'DeviseController'
|
|
26
|
+
|
|
27
|
+ # ==> Mailer Configuration
|
|
28
|
+ # Configure the e-mail address which will be shown in Devise::Mailer,
|
|
29
|
+ # note that it will be overwritten if you use your own mailer class
|
|
30
|
+ # with default "from" parameter.
|
|
31
|
+ config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
|
|
32
|
+
|
|
33
|
+ # Configure the class responsible to send e-mails.
|
|
34
|
+ # config.mailer = 'Devise::Mailer'
|
|
35
|
+
|
|
36
|
+ # Configure the parent class responsible to send e-mails.
|
|
37
|
+ # config.parent_mailer = 'ActionMailer::Base'
|
|
38
|
+
|
|
39
|
+ # ==> ORM configuration
|
|
40
|
+ # Load and configure the ORM. Supports :active_record (default) and
|
|
41
|
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
|
|
42
|
+ # available as additional gems.
|
|
43
|
+ require 'devise/orm/active_record'
|
|
44
|
+
|
|
45
|
+ # ==> Configuration for any authentication mechanism
|
|
46
|
+ # Configure which keys are used when authenticating a user. The default is
|
|
47
|
+ # just :email. You can configure it to use [:username, :subdomain], so for
|
|
48
|
+ # authenticating a user, both parameters are required. Remember that those
|
|
49
|
+ # parameters are used only when authenticating and not when retrieving from
|
|
50
|
+ # session. If you need permissions, you should implement that in a before filter.
|
|
51
|
+ # You can also supply a hash where the value is a boolean determining whether
|
|
52
|
+ # or not authentication should be aborted when the value is not present.
|
|
53
|
+ # config.authentication_keys = [:email]
|
|
54
|
+
|
|
55
|
+ # Configure parameters from the request object used for authentication. Each entry
|
|
56
|
+ # given should be a request method and it will automatically be passed to the
|
|
57
|
+ # find_for_authentication method and considered in your model lookup. For instance,
|
|
58
|
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
|
59
|
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
|
|
60
|
+ # config.request_keys = []
|
|
61
|
+
|
|
62
|
+ # Configure which authentication keys should be case-insensitive.
|
|
63
|
+ # These keys will be downcased upon creating or modifying a user and when used
|
|
64
|
+ # to authenticate or find a user. Default is :email.
|
|
65
|
+ config.case_insensitive_keys = [:email]
|
|
66
|
+
|
|
67
|
+ # Configure which authentication keys should have whitespace stripped.
|
|
68
|
+ # These keys will have whitespace before and after removed upon creating or
|
|
69
|
+ # modifying a user and when used to authenticate or find a user. Default is :email.
|
|
70
|
+ config.strip_whitespace_keys = [:email]
|
|
71
|
+
|
|
72
|
+ # Tell if authentication through request.params is enabled. True by default.
|
|
73
|
+ # It can be set to an array that will enable params authentication only for the
|
|
74
|
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
|
|
75
|
+ # enable it only for database (email + password) authentication.
|
|
76
|
+ # config.params_authenticatable = true
|
|
77
|
+
|
|
78
|
+ # Tell if authentication through HTTP Auth is enabled. False by default.
|
|
79
|
+ # It can be set to an array that will enable http authentication only for the
|
|
80
|
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
|
|
81
|
+ # enable it only for database authentication.
|
|
82
|
+ # For API-only applications to support authentication "out-of-the-box", you will likely want to
|
|
83
|
+ # enable this with :database unless you are using a custom strategy.
|
|
84
|
+ # The supported strategies are:
|
|
85
|
+ # :database = Support basic authentication with authentication key + password
|
|
86
|
+ # config.http_authenticatable = false
|
|
87
|
+
|
|
88
|
+ # If 401 status code should be returned for AJAX requests. True by default.
|
|
89
|
+ # config.http_authenticatable_on_xhr = true
|
|
90
|
+
|
|
91
|
+ # The realm used in Http Basic Authentication. 'Application' by default.
|
|
92
|
+ # config.http_authentication_realm = 'Application'
|
|
93
|
+
|
|
94
|
+ # It will change confirmation, password recovery and other workflows
|
|
95
|
+ # to behave the same regardless if the e-mail provided was right or wrong.
|
|
96
|
+ # Does not affect registerable.
|
|
97
|
+ # config.paranoid = true
|
|
98
|
+
|
|
99
|
+ # By default Devise will store the user in session. You can skip storage for
|
|
100
|
+ # particular strategies by setting this option.
|
|
101
|
+ # Notice that if you are skipping storage for all authentication paths, you
|
|
102
|
+ # may want to disable generating routes to Devise's sessions controller by
|
|
103
|
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
|
|
104
|
+ config.skip_session_storage = [:http_auth]
|
|
105
|
+
|
|
106
|
+ # By default, Devise cleans up the CSRF token on authentication to
|
|
107
|
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
|
|
108
|
+ # requests for sign in and sign up, you need to get a new CSRF token
|
|
109
|
+ # from the server. You can disable this option at your own risk.
|
|
110
|
+ # config.clean_up_csrf_token_on_authentication = true
|
|
111
|
+
|
|
112
|
+ # When false, Devise will not attempt to reload routes on eager load.
|
|
113
|
+ # This can reduce the time taken to boot the app but if your application
|
|
114
|
+ # requires the Devise mappings to be loaded during boot time the application
|
|
115
|
+ # won't boot properly.
|
|
116
|
+ # config.reload_routes = true
|
|
117
|
+
|
|
118
|
+ # ==> Configuration for :database_authenticatable
|
|
119
|
+ # For bcrypt, this is the cost for hashing the password and defaults to 12. If
|
|
120
|
+ # using other algorithms, it sets how many times you want the password to be hashed.
|
|
121
|
+ # The number of stretches used for generating the hashed password are stored
|
|
122
|
+ # with the hashed password. This allows you to change the stretches without
|
|
123
|
+ # invalidating existing passwords.
|
|
124
|
+ #
|
|
125
|
+ # Limiting the stretches to just one in testing will increase the performance of
|
|
126
|
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
|
127
|
+ # a value less than 10 in other environments. Note that, for bcrypt (the default
|
|
128
|
+ # algorithm), the cost increases exponentially with the number of stretches (e.g.
|
|
129
|
+ # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
|
|
130
|
+ config.stretches = Rails.env.test? ? 1 : 12
|
|
131
|
+
|
|
132
|
+ # Set up a pepper to generate the hashed password.
|
|
133
|
+ # rubocop:todo Layout/LineLength
|
|
134
|
+ # config.pepper = 'ebea61cb22496cb93b330ea8fc5267fbc95ceb201f71d85b7fa0886d62310b4ac552905066c7bbff42429e0c9b02cb211592a169d888cb6bf0bf0fa88da573c1'
|
|
135
|
+ # rubocop:enable Layout/LineLength
|
|
136
|
+
|
|
137
|
+ # Send a notification to the original email when the user's email is changed.
|
|
138
|
+ # config.send_email_changed_notification = false
|
|
139
|
+
|
|
140
|
+ # Send a notification email when the user's password is changed.
|
|
141
|
+ # config.send_password_change_notification = false
|
|
142
|
+
|
|
143
|
+ # ==> Configuration for :confirmable
|
|
144
|
+ # A period that the user is allowed to access the website even without
|
|
145
|
+ # confirming their account. For instance, if set to 2.days, the user will be
|
|
146
|
+ # able to access the website for two days without confirming their account,
|
|
147
|
+ # access will be blocked just in the third day.
|
|
148
|
+ # You can also set it to nil, which will allow the user to access the website
|
|
149
|
+ # without confirming their account.
|
|
150
|
+ # Default is 0.days, meaning the user cannot access the website without
|
|
151
|
+ # confirming their account.
|
|
152
|
+ # config.allow_unconfirmed_access_for = 2.days
|
|
153
|
+
|
|
154
|
+ # A period that the user is allowed to confirm their account before their
|
|
155
|
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
|
|
156
|
+ # their account within 3 days after the mail was sent, but on the fourth day
|
|
157
|
+ # their account can't be confirmed with the token any more.
|
|
158
|
+ # Default is nil, meaning there is no restriction on how long a user can take
|
|
159
|
+ # before confirming their account.
|
|
160
|
+ # config.confirm_within = 3.days
|
|
161
|
+
|
|
162
|
+ # If true, requires any email changes to be confirmed (exactly the same way as
|
|
163
|
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
|
|
164
|
+ # db field (see migrations). Until confirmed, new email is stored in
|
|
165
|
+ # unconfirmed_email column, and copied to email column on successful confirmation.
|
|
166
|
+ config.reconfirmable = true
|
|
167
|
+
|
|
168
|
+ # Defines which key will be used when confirming an account
|
|
169
|
+ # config.confirmation_keys = [:email]
|
|
170
|
+
|
|
171
|
+ # ==> Configuration for :rememberable
|
|
172
|
+ # The time the user will be remembered without asking for credentials again.
|
|
173
|
+ # config.remember_for = 2.weeks
|
|
174
|
+
|
|
175
|
+ # Invalidates all the remember me tokens when the user signs out.
|
|
176
|
+ config.expire_all_remember_me_on_sign_out = true
|
|
177
|
+
|
|
178
|
+ # If true, extends the user's remember period when remembered via cookie.
|
|
179
|
+ # config.extend_remember_period = false
|
|
180
|
+
|
|
181
|
+ # Options to be passed to the created cookie. For instance, you can set
|
|
182
|
+ # secure: true in order to force SSL only cookies.
|
|
183
|
+ # config.rememberable_options = {}
|
|
184
|
+
|
|
185
|
+ # ==> Configuration for :validatable
|
|
186
|
+ # Range for password length.
|
|
187
|
+ config.password_length = 6..128
|
|
188
|
+
|
|
189
|
+ # Email regex used to validate email formats. It simply asserts that
|
|
190
|
+ # one (and only one) @ exists in the given string. This is mainly
|
|
191
|
+ # to give user feedback and not to assert the e-mail validity.
|
|
192
|
+ config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
|
|
193
|
+
|
|
194
|
+ # ==> Configuration for :timeoutable
|
|
195
|
+ # The time you want to timeout the user session without activity. After this
|
|
196
|
+ # time the user will be asked for credentials again. Default is 30 minutes.
|
|
197
|
+ # config.timeout_in = 30.minutes
|
|
198
|
+
|
|
199
|
+ # ==> Configuration for :lockable
|
|
200
|
+ # Defines which strategy will be used to lock an account.
|
|
201
|
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
|
202
|
+ # :none = No lock strategy. You should handle locking by yourself.
|
|
203
|
+ # config.lock_strategy = :failed_attempts
|
|
204
|
+
|
|
205
|
+ # Defines which key will be used when locking and unlocking an account
|
|
206
|
+ # config.unlock_keys = [:email]
|
|
207
|
+
|
|
208
|
+ # Defines which strategy will be used to unlock an account.
|
|
209
|
+ # :email = Sends an unlock link to the user email
|
|
210
|
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
|
211
|
+ # :both = Enables both strategies
|
|
212
|
+ # :none = No unlock strategy. You should handle unlocking by yourself.
|
|
213
|
+ # config.unlock_strategy = :both
|
|
214
|
+
|
|
215
|
+ # Number of authentication tries before locking an account if lock_strategy
|
|
216
|
+ # is failed attempts.
|
|
217
|
+ # config.maximum_attempts = 20
|
|
218
|
+
|
|
219
|
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
|
|
220
|
+ # config.unlock_in = 1.hour
|
|
221
|
+
|
|
222
|
+ # Warn on the last attempt before the account is locked.
|
|
223
|
+ # config.last_attempt_warning = true
|
|
224
|
+
|
|
225
|
+ # ==> Configuration for :recoverable
|
|
226
|
+ #
|
|
227
|
+ # Defines which key will be used when recovering the password for an account
|
|
228
|
+ # config.reset_password_keys = [:email]
|
|
229
|
+
|
|
230
|
+ # Time interval you can reset your password with a reset password key.
|
|
231
|
+ # Don't put a too small interval or your users won't have the time to
|
|
232
|
+ # change their passwords.
|
|
233
|
+ config.reset_password_within = 6.hours
|
|
234
|
+
|
|
235
|
+ # When set to false, does not sign a user in automatically after their password is
|
|
236
|
+ # reset. Defaults to true, so a user is signed in automatically after a reset.
|
|
237
|
+ # config.sign_in_after_reset_password = true
|
|
238
|
+
|
|
239
|
+ # ==> Configuration for :encryptable
|
|
240
|
+ # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
|
|
241
|
+ # You can use :sha1, :sha512 or algorithms from others authentication tools as
|
|
242
|
+ # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
|
|
243
|
+ # for default behavior) and :restful_authentication_sha1 (then you should set
|
|
244
|
+ # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
|
|
245
|
+ #
|
|
246
|
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
|
|
247
|
+ # config.encryptor = :sha512
|
|
248
|
+
|
|
249
|
+ # ==> Scopes configuration
|
|
250
|
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
|
|
251
|
+ # "users/sessions/new". It's turned off by default because it's slower if you
|
|
252
|
+ # are using only default views.
|
|
253
|
+ # config.scoped_views = false
|
|
254
|
+
|
|
255
|
+ # Configure the default scope given to Warden. By default it's the first
|
|
256
|
+ # devise role declared in your routes (usually :user).
|
|
257
|
+ # config.default_scope = :user
|
|
258
|
+
|
|
259
|
+ # Set this configuration to false if you want /users/sign_out to sign out
|
|
260
|
+ # only the current scope. By default, Devise signs out all scopes.
|
|
261
|
+ # config.sign_out_all_scopes = true
|
|
262
|
+
|
|
263
|
+ # ==> Navigation configuration
|
|
264
|
+ # Lists the formats that should be treated as navigational. Formats like
|
|
265
|
+ # :html, should redirect to the sign in page when the user does not have
|
|
266
|
+ # access, but formats like :xml or :json, should return 401.
|
|
267
|
+ #
|
|
268
|
+ # If you have any extra navigational formats, like :iphone or :mobile, you
|
|
269
|
+ # should add them to the navigational formats lists.
|
|
270
|
+ #
|
|
271
|
+ # The "*/*" below is required to match Internet Explorer requests.
|
|
272
|
+ # config.navigational_formats = ['*/*', :html]
|
|
273
|
+
|
|
274
|
+ # The default HTTP method used to sign out a resource. Default is :delete.
|
|
275
|
+ config.sign_out_via = :delete
|
|
276
|
+
|
|
277
|
+ # ==> OmniAuth
|
|
278
|
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
|
|
279
|
+ # up on your models and hooks.
|
|
280
|
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
|
|
281
|
+
|
|
282
|
+ # ==> Warden configuration
|
|
283
|
+ # If you want to use other strategies, that are not supported by Devise, or
|
|
284
|
+ # change the failure app, you can configure them inside the config.warden block.
|
|
285
|
+ #
|
|
286
|
+ # config.warden do |manager|
|
|
287
|
+ # manager.intercept_401 = false
|
|
288
|
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
|
|
289
|
+ # end
|
|
290
|
+
|
|
291
|
+ # ==> Mountable engine configurations
|
|
292
|
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
|
|
293
|
+ # is mountable, there are some extra configurations to be taken into account.
|
|
294
|
+ # The following options are available, assuming the engine is mounted as:
|
|
295
|
+ #
|
|
296
|
+ # mount MyEngine, at: '/my_engine'
|
|
297
|
+ #
|
|
298
|
+ # The router that invoked `devise_for`, in the example above, would be:
|
|
299
|
+ # config.router_name = :my_engine
|
|
300
|
+ #
|
|
301
|
+ # When using OmniAuth, Devise cannot automatically set OmniAuth path,
|
|
302
|
+ # so you need to do it manually. For the users scope, it would be:
|
|
303
|
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
|
|
304
|
+
|
|
305
|
+ # ==> Turbolinks configuration
|
|
306
|
+ # If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly:
|
|
307
|
+ #
|
|
308
|
+ # ActiveSupport.on_load(:devise_failure_app) do
|
|
309
|
+ # include Turbolinks::Controller
|
|
310
|
+ # end
|
|
311
|
+
|
|
312
|
+ # ==> Configuration for :registerable
|
|
313
|
+
|
|
314
|
+ # When set to false, does not sign a user in automatically after their password is
|
|
315
|
+ # changed. Defaults to true, so a user is signed in automatically after changing a password.
|
|
316
|
+ # config.sign_in_after_change_password = true
|
|
317
|
+end |
...
|
...
|
|