Method: Sorcery::Model::Submodules::BruteForceProtection::InstanceMethods#register_failed_login!

Defined in:
lib/sorcery/model/submodules/brute_force_protection.rb

#register_failed_login!Object

Called by the controller to increment the failed logins counter. Calls ‘lock!’ if login retries limit was reached.



62
63
64
65
66
67
68
69
70
71
# File 'lib/sorcery/model/submodules/brute_force_protection.rb', line 62

def register_failed_login!
  config = sorcery_config
  return if !unlocked?

  sorcery_adapter.increment(config.failed_logins_count_attribute_name)

  if self.send(config.failed_logins_count_attribute_name) >= config.
    lock!
  end
end