Displaying 1 result from an estimated 1 matches for "my_profile_password".
2007 May 31
1
Form Change Old Password
Hello there,
I want my users to be able to change their password.
I wrote the code below but I need help to add error if the old password
he posted did not match the current password he have.
In the controller I have:
def my_profile_password
return true unless request.post?
@user = current_user
if @user.check_password(params[:old_password])
@user.update_attributes(params[:user])
if @user.update
end
end
end
and in my model:
def check_password(password)
if self.password == User.encrypt(password)
true
end
end...