Move failed_attempts increment into its a function (#4351)

With this change one can overwrite when the incrementation is handled without duplicating the other `valid_for_authentication` logic.
This commit is contained in:
Lutz Lengemann
2017-12-21 19:49:09 +01:00
committed by Leonardo Tegon
parent 5a3b7a1771
commit 7b3081760f

View File

@@ -101,8 +101,7 @@ module Devise
if super && !access_locked?
true
else
self.failed_attempts ||= 0
self.failed_attempts += 1
increment_failed_attempts
if attempts_exceeded?
lock_access! unless access_locked?
else
@@ -111,6 +110,11 @@ module Devise
false
end
end
def increment_failed_attempts
self.failed_attempts ||= 0
self.failed_attempts += 1
end
def unauthenticated_message
# If set to paranoid mode, do not show the locked message because it