开发者

How to change a password in ROR if using acts_as_authentic

开发者 https://www.devze.com 2023-04-01 02:32 出处:网络
I am using the plugin acts_as_authentic!Then i want to design a page to change the password!And I don\'t know how to deal with it!

I am using the plugin acts_as_authentic!Then i want to design a page to change the password!And I don't know how to deal with it! First,how to test and ve开发者_开发知识库rify the old password? Then,when it gets wrong ,does any validations should be made? sorry for My poor English! Maybe I don't make it clear! Any comments would be appreciated! Thank you very much!


I user auth logic, but checking the old password is just the same. Your User model should have a salt field, so all you need to do is encrypt the string

params[:password] + current_user.salt

using whatever encryption acts_as_authentic is configured to use. You can check what your Users' salt field is called simply by using the rails console and typing User.new. Hope that helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号