Created
March 2, 2010 05:41
-
-
Save lxneng/319171 to your computer and use it in GitHub Desktop.
change_password
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def change_password?(passwords) | |
self.password_confirmation = passwords[:password_confirmation] | |
self.verify_password = passwords[:verify_password] | |
unless verify_password == unencrypted_password | |
errors.add(:password, "is incorrect") | |
return false | |
end | |
unless passwords[:new_password] == password_confirmation | |
errors.add(:password, "does not match confirmation") | |
return false | |
end | |
self.password = passwords[:new_password] | |
save | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment