1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Use confirmed_at as flag.

This commit is contained in:
José Valim 2010-07-08 08:21:14 +02:00
parent 9c5ff02ff1
commit eca511a8f2

View file

@ -45,7 +45,7 @@ module Devise
# Verifies whether a user is confirmed or not # Verifies whether a user is confirmed or not
def confirmed? def confirmed?
persisted? && !confirmed_at.nil? !!confirmed_at
end end
# Send confirmation instructions by email # Send confirmation instructions by email
@ -75,15 +75,14 @@ module Devise
# If you don't want confirmation to be sent on create, neither a code # If you don't want confirmation to be sent on create, neither a code
# to be generated, call skip_confirmation! # to be generated, call skip_confirmation!
def skip_confirmation! def skip_confirmation!
self.confirmed_at = Time.now self.confirmed_at = Time.now
@skip_confirmation = true
end end
protected protected
# Callback to overwrite if confirmation is required or not. # Callback to overwrite if confirmation is required or not.
def confirmation_required? def confirmation_required?
!@skip_confirmation !confirmed?
end end
# Checks if the confirmation for the user is within the limit time. # Checks if the confirmation for the user is within the limit time.