mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-10 08:08:00 -05:00
Persist unlock token before triggering mailer
This commit is contained in:
@@ -38,11 +38,11 @@ module Devise
|
||||
self.locked_at = Time.now.utc
|
||||
|
||||
if unlock_strategy_enabled?(:email)
|
||||
generate_unlock_token
|
||||
generate_unlock_token!
|
||||
send_unlock_instructions
|
||||
else
|
||||
save(:validate => false)
|
||||
end
|
||||
|
||||
save(:validate => false)
|
||||
end
|
||||
|
||||
# Unlock a user by cleaning locked_at and failed_attempts.
|
||||
@@ -123,6 +123,10 @@ module Devise
|
||||
self.unlock_token = self.class.unlock_token
|
||||
end
|
||||
|
||||
def generate_unlock_token!
|
||||
generate_unlock_token && save(:validate => false)
|
||||
end
|
||||
|
||||
# Tells if the lock is expired if :time unlock strategy is active
|
||||
def lock_expired?
|
||||
if unlock_strategy_enabled?(:time)
|
||||
|
||||
Reference in New Issue
Block a user