mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Persist unlock token before triggering mailer
This commit is contained in:
parent
6dd7ccee68
commit
fe0f6e96b3
1 changed files with 7 additions and 3 deletions
|
@ -38,11 +38,11 @@ module Devise
|
||||||
self.locked_at = Time.now.utc
|
self.locked_at = Time.now.utc
|
||||||
|
|
||||||
if unlock_strategy_enabled?(:email)
|
if unlock_strategy_enabled?(:email)
|
||||||
generate_unlock_token
|
generate_unlock_token!
|
||||||
send_unlock_instructions
|
send_unlock_instructions
|
||||||
|
else
|
||||||
|
save(:validate => false)
|
||||||
end
|
end
|
||||||
|
|
||||||
save(:validate => false)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Unlock a user by cleaning locked_at and failed_attempts.
|
# Unlock a user by cleaning locked_at and failed_attempts.
|
||||||
|
@ -123,6 +123,10 @@ module Devise
|
||||||
self.unlock_token = self.class.unlock_token
|
self.unlock_token = self.class.unlock_token
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def generate_unlock_token!
|
||||||
|
generate_unlock_token && save(:validate => false)
|
||||||
|
end
|
||||||
|
|
||||||
# Tells if the lock is expired if :time unlock strategy is active
|
# Tells if the lock is expired if :time unlock strategy is active
|
||||||
def lock_expired?
|
def lock_expired?
|
||||||
if unlock_strategy_enabled?(:time)
|
if unlock_strategy_enabled?(:time)
|
||||||
|
|
Loading…
Reference in a new issue