The name is a bit confusing, so I will explain. I have the following controller method:
def password_update @op = params[:old_password] @np = params[:new_password] @cp = params[:confirm_password] if @np == @cp if !@np.empty ? if current_user.update_with_password(:current_password=> @op) current_user.password = @np if current_user.save flash[:notice] = "Password Successfully Changed" redirect_to settings_path and return end else flash[:notice] = "Incorrent Current Password" redirect_to change_password_path and return end else flash[:notice] = "New Password Cannot Be Blank" end elsel flash[:notice] = "Incorrect Password Confirmation" end redirect_to change_password_path end
Everything else works beautifully, which means that I have work routes and views that lead you to this method and call it submitting a form. The error occurs, however, when I try to correctly change my password. By the way, I am using Devise. When I click the "Submit" button, I log out and it says "you must be logged in to complete this action." So I try to log in, my current password does not work. He changed my password (the one I set on the form)! He tells me that I must be signed (that I when I try to change my password), but he changes it anyway.
Any help is appreciated, however, I'm a beginner and really appreciate the detailed explanation. Thanks!
source share