Skip to content

Commit

Permalink
Set a default value for lockout period
Browse files Browse the repository at this point in the history
**Why**: Instead of having to rely on devops to deploy Figaro config
changes before we can deploy code to our lower envs, we can make the
`lockout_period_in_minutes` optional, and set a default value for it.
  • Loading branch information
monfresh committed Jun 27, 2017
1 parent fc9eb66 commit 286c172
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 7 additions & 1 deletion app/decorators/user_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

class UserDecorator
MAX_RECENT_EVENTS = 5
DEFAULT_LOCKOUT_PERIOD = 10.minutes

def initialize(user)
@user = user
Expand Down Expand Up @@ -137,7 +138,12 @@ def masked_number(number)
end

def lockout_period
Figaro.env.lockout_period_in_minutes.to_i.minutes
return DEFAULT_LOCKOUT_PERIOD if lockout_period_config.blank?
lockout_period_config.to_i.minutes
end

def lockout_period_config
@config ||= Figaro.env.lockout_period_in_minutes
end

def lockout_period_expired?
Expand Down
1 change: 0 additions & 1 deletion config/initializers/figaro.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
'equifax_ssh_passphrase',
'hmac_fingerprinter_key',
'idp_sso_target_url',
'lockout_period_in_minutes',
'logins_per_ip_limit',
'logins_per_ip_period',
'max_mail_events',
Expand Down

0 comments on commit 286c172

Please sign in to comment.