I'm building a "change password" form for my user built with these fields:
I need a way to check if the current logged in user password is the same as "old password" field, are there any possibility to do this, with authlogic? I can't find a method to test a password.
Authlogic has a valid_password? method. see: http://rubydoc.info/github/binarylogic/authlogic/master/Authlogic/ActsAsAuthentic/Password/Methods/InstanceMethods#valid_password%3F-instance_method
So you could
if @user.valid_password?(params[:old_password])
@user.password = params[:new_password]
@user.password_confirmation = params[:new_password_confirmation]
end
(or similar)