mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Reduce ORM API surface
This commit is contained in:
parent
e6b5f5f31a
commit
e841c4c5ef
1 changed files with 4 additions and 1 deletions
|
@ -2,6 +2,9 @@
|
|||
# This is only triggered when the user is explicitly set (with set_user)
|
||||
Warden::Manager.after_set_user except: :fetch do |record, warden, options|
|
||||
if record.respond_to?(:failed_attempts) && warden.authenticated?(options[:scope])
|
||||
record.update_attribute(:failed_attempts, 0) unless record.failed_attempts.to_i.zero?
|
||||
unless record.failed_attempts.to_i.zero?
|
||||
record.failed_attempts = 0
|
||||
record.save(validate: false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue