LearningRoR
LearningRoR

Reputation: 27212

Having users provide current password to change password or email

I have a users authentication system I made from scratch with the help of the Rails cast and for the edit form I want to have the users need to type in their current password in order to change their email or password.I'm not sure how this would be built, could anyone help me or point me in the right direction?

Thank you.

Upvotes: 0

Views: 144

Answers (1)

Dave Newton
Dave Newton

Reputation: 160191

They'd enter the password, you'd encrypt it and compare it against the model's encrypted password value, and if they match, you'd do the update. If they don't, you wouldn't.

Upvotes: 2

Related Questions