如果使用acts_as_authentic,如何更改 ROR 中的密码

发布于 2024-12-02 17:28:42 字数 132 浏览 5 评论 0原文

我正在使用插件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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不寐倦长更 2024-12-09 17:28:43

我使用身份验证逻辑,但检查旧密码是一样的。您的用户模型应该有一个盐字段,因此您需要做的就是

params[:password] + current_user.salt

使用配置为使用的任何加密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

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文