从 Rails 控制台设计密码重置 [英] Devise password reset from Rails console

查看:19
本文介绍了从 Rails 控制台设计密码重置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在运行应用程序时,如何通过电子邮件地址选择用户,然后在 rails 控制台 中为 Devise 手动设置密码?

While running an app how do you select a user by email address and then set the password manually within rails console for Devise?

此外,在使用 Devise 时,我应该去哪里查看文档以涵盖有关操纵帐户的更多详细信息?

Also, where would I go to review documentation to cover more details in this regard to manipulation of accounts while using Devise?

推荐答案

现代设计允许更简单的语法,无需设置确认字段

Modern devise allows simpler syntax, no need to set the confirmation field

user.password = new_password; user.save
# or
user.update(password: new_password)

这篇关于从 Rails 控制台设计密码重置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆