Use confirmed_at as flag.

This commit is contained in:
José Valim 2010-07-08 08:21:14 +02:00
parent 9c5ff02ff1
commit eca511a8f2
1 changed files with 3 additions and 4 deletions

View File

@ -45,7 +45,7 @@ module Devise
# Verifies whether a user is confirmed or not
def confirmed?
persisted? && !confirmed_at.nil?
!!confirmed_at
end
# 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
# to be generated, call skip_confirmation!
def skip_confirmation!
self.confirmed_at = Time.now
@skip_confirmation = true
self.confirmed_at = Time.now
end
protected
# Callback to overwrite if confirmation is required or not.
def confirmation_required?
!@skip_confirmation
!confirmed?
end
# Checks if the confirmation for the user is within the limit time.