Module: Sorcery::Model::Submodules::BruteForceProtection::InstanceMethods

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

Instance Method Summary collapse

Instance Method Details

#login_locked?Boolean

Returns:

  • (Boolean)


88
89
90
# File 'lib/sorcery/model/submodules/brute_force_protection.rb', line 88

def 
  !
end

#login_unlock!Object

/!\ Moved out of protected for use like activate! in controller /!\



80
81
82
83
84
85
86
# File 'lib/sorcery/model/submodules/brute_force_protection.rb', line 80

def 
  config = sorcery_config
  attributes = { config.lock_expires_at_attribute_name => nil,
                 config.failed_logins_count_attribute_name => 0,
                 config.unlock_token_attribute_name => nil }
  sorcery_adapter.update_attributes(attributes)
end

#register_failed_login!Object

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



66
67
68
69
70
71
72
73
74
75
# File 'lib/sorcery/model/submodules/brute_force_protection.rb', line 66

def register_failed_login!
  config = sorcery_config
  return unless 

  sorcery_adapter.increment(config.failed_logins_count_attribute_name)

  return unless send(config.failed_logins_count_attribute_name) >= config.

  
end