如果使用acts_as_authentic,如何更改 ROR 中的密码
我正在使用插件acts_as_authentic!然后我想设计一个页面来更改密码!而且我不知道如何处理! 一、如何测试和验证旧密码? 那么,当出现错误时,是否应该进行任何验证? 对不起我糟糕的英语!可能是我没说清楚! 任何评论将不胜感激! 非常感谢!
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 verify 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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用身份验证逻辑,但检查旧密码是一样的。您的用户模型应该有一个盐字段,因此您需要做的就是
使用配置为使用的任何加密acts_as_authentic来加密字符串。您只需使用 Rails 控制台并输入 User.new 即可检查用户的盐田的名称。希望有帮助。
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
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.