|
@@ -103,7 +103,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 = Utils.parse_duration(ENV['ALLOW_UNCONFIRMED_ACCESS_FOR']).presence || 2.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
|
|
@@ -111,7 +111,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 = Utils.parse_duration(ENV['CONFIRM_WITHIN']).presence || 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
|
|
@@ -124,7 +124,7 @@ Devise.setup do |config|
|
|
|
|
|
|
# ==> Configuration for :rememberable
|
|
|
# The time the user will be remembered without asking for credentials again.
|
|
|
- config.remember_for = 4.weeks
|
|
|
+ config.remember_for = Utils.parse_duration(ENV['REMEMBER_FOR']).presence || 4.weeks
|
|
|
|
|
|
# Invalidates all the remember me tokens when the user signs out.
|
|
|
config.expire_all_remember_me_on_sign_out = true
|
|
@@ -142,7 +142,7 @@ Devise.setup do |config|
|
|
|
|
|
|
# ==> Configuration for :validatable
|
|
|
# Range for password length.
|
|
|
- config.password_length = 8..128
|
|
|
+ config.password_length = (Utils.if_present(ENV['MIN_PASSWORD_LENGTH'], :to_i) || 8)..128
|
|
|
|
|
|
# Email regex used to validate email formats. It simply asserts that
|
|
|
# one (and only one) @ exists in the given string. This is mainly
|
|
@@ -158,7 +158,7 @@ Devise.setup do |config|
|
|
|
# Defines which strategy will be used to lock an account.
|
|
|
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
|
|
# :none = No lock strategy. You should handle locking by yourself.
|
|
|
- config.lock_strategy = :failed_attempts
|
|
|
+ config.lock_strategy = Utils.if_present(ENV['LOCK_STRATEGY'], :to_sym) || :failed_attempts
|
|
|
|
|
|
# Defines which key will be used when locking and unlocking an account
|
|
|
config.unlock_keys = [ :email ]
|
|
@@ -168,14 +168,14 @@ Devise.setup do |config|
|
|
|
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
|
|
# :both = Enables both strategies
|
|
|
# :none = No unlock strategy. You should handle unlocking by yourself.
|
|
|
- config.unlock_strategy = :both
|
|
|
+ config.unlock_strategy = Utils.if_present(ENV['UNLOCK_STRATEGY'], :to_sym) || :both
|
|
|
|
|
|
# Number of authentication tries before locking an account if lock_strategy
|
|
|
# is failed attempts.
|
|
|
- config.maximum_attempts = 10
|
|
|
+ config.maximum_attempts = Utils.if_present(ENV['MAX_FAILED_LOGIN_ATTEMPTS'], :to_i) || 10
|
|
|
|
|
|
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
|
|
- config.unlock_in = 1.hour
|
|
|
+ config.unlock_in = Utils.parse_duration(ENV['UNLOCK_AFTER']).presence || 1.hour
|
|
|
|
|
|
# Warn on the last attempt before the account is locked.
|
|
|
# config.last_attempt_warning = true
|
|
@@ -188,7 +188,7 @@ Devise.setup do |config|
|
|
|
# Time interval you can reset your password with a reset password key.
|
|
|
# Don't put a too small interval or your users won't have the time to
|
|
|
# change their passwords.
|
|
|
- config.reset_password_within = 6.hours
|
|
|
+ config.reset_password_within = Utils.parse_duration(ENV['RESET_PASSWORD_WITHIN']).presence || 6.hours
|
|
|
|
|
|
# ==> Configuration for :encryptable
|
|
|
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
|