Method: Credential#locked_until

Defined in:
app/models/credential.rb

#locked_until(find_at) ⇒ Object



70
71
72
73
74
75
76
77
78
79
80
# File 'app/models/credential.rb', line 70

def locked_until(find_at)
  # NOTE: There's a multiplier effect here. So, if the lockout_threshold is 3, and there's been 12 unsuccessful logins
  # we're not going to let them in for another 4*lockout_duration seconds

  # How long we've been locked out for
  been_locked_out_for = (find_at - ).seconds
  
  lockout_multiplier = ( / ).floor
  
   * lockout_multiplier - been_locked_out_for
end