ruby on rails - Devise, validate current_password if any important fields have been changed -
Specifically, I'm using Devise with Typus. But, I think my misunderstanding lives in the knowledge of my knowledge.
When you want to change an important model through the form, you can provide your current password to confirm it, it can change, a la Google.
Right now, I can log in and change any area of my user model. Before password, before confirming my password is not good. Therefore, I have currently added the password. But he did nothing, then I tried to validate the appearance on the current_password. Again, no value is accepted for it.
Google did not help me but all related posts were about removing current_password instead of confirming it. Which I think is misinterpreting the use of current_password.
Does anyone care about sharing some insights? Thank you.
You must add a password field to the form, and then you can validate the password in the action of your controller Usage:
user.valid_password? (Param [: user] [: password]) Note that you should change the parameter [: user] [: password] in the form for the field of your password field Name (probably just params [: password]).
Hope this will be helpful.
Comments
Post a Comment