From 4c445f6ed337dc9acf71783bc9e12b76cc7e6efd Mon Sep 17 00:00:00 2001 From: Bryan Larsen Date: Tue, 22 Dec 2009 12:16:36 -0600 Subject: [PATCH] [#590 state:resolved] stash current_password to avoid bug #590. --- hobo/lib/hobo/user.rb | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/hobo/lib/hobo/user.rb b/hobo/lib/hobo/user.rb index bc7fb90..163496d 100644 --- a/hobo/lib/hobo/user.rb +++ b/hobo/lib/hobo/user.rb @@ -43,6 +43,7 @@ module Hobo attr_accessor :current_password, :password, :password_confirmation, :type => :password before_save :encrypt_password + after_save :stash_current_password never_show *AUTHENTICATION_FIELDS @@ -148,6 +149,13 @@ module Hobo self.crypted_password = encrypt(password) end + # after filter that sets current_password so we can pass + # validate_current_password_when_changing_password if you save + # again. See + # https://hobo.lighthouseapp.com/projects/8324-hobo/tickets/590 + def stash_current_password + self.current_password ||= password + end def changing_password? !new_record? && !lifecycle_changing_password? && -- 1.6.3.3