Skip to content

Commit

Permalink
Refactor to use method and override
Browse files Browse the repository at this point in the history
  • Loading branch information
gtd committed Aug 2, 2011
1 parent ed6dfed commit fd07c74
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/devise/models/confirmable.rb
Expand Up @@ -127,6 +127,11 @@ def generate_confirmation_token!
generate_confirmation_token && save(:validate => false)
end

def after_password_reset
super
confirm! unless confirmed?
end

module ClassMethods
# Attempt to find a user by it's email. If a record is found, send new
# confirmation instructions to it. If not user is found, returns a new user
Expand Down
5 changes: 4 additions & 1 deletion lib/devise/models/recoverable.rb
Expand Up @@ -31,7 +31,7 @@ def reset_password!(new_password, new_password_confirmation)
self.password_confirmation = new_password_confirmation
if valid?
clear_reset_password_token
confirm! if respond_to?(:confirmed?) && !confirmed?
after_password_reset
end

save
Expand Down Expand Up @@ -93,6 +93,9 @@ def clear_reset_password_token
self.reset_password_sent_at = nil if respond_to?(:reset_password_sent_at=)
end

def after_password_reset
end

module ClassMethods
# Attempt to find a user by it's email. If a record is found, send new
# password instructions to it. If not user is found, returns a new user
Expand Down

0 comments on commit fd07c74

Please sign in to comment.