diff --git a/lib/devise/models/confirmable.rb b/lib/devise/models/confirmable.rb index fd6d7f9d94..2251adf37d 100644 --- a/lib/devise/models/confirmable.rb +++ b/lib/devise/models/confirmable.rb @@ -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 diff --git a/lib/devise/models/recoverable.rb b/lib/devise/models/recoverable.rb index 77c3073664..07ec764c39 100644 --- a/lib/devise/models/recoverable.rb +++ b/lib/devise/models/recoverable.rb @@ -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 @@ -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