使用 Devise 将可确认的模块添加到现有站点

2024-04-04

我正在使用 devise 开发一个网络应用程序,并希望将可确认的模块添加到该网站。但是,由于未生成确认令牌,用户无法登录。单击“未收到确认说明?”时链接令牌仍然没有生成。

确认电子邮件仅生成此链接(请注意网址中缺少令牌):

<p><a href="http://localhost:3000/users/confirmation">Confirm my account</a></p>

让它发挥作用的最佳方法是什么?

非常感谢,
Tony


我正在寻找相同的答案。我怀疑答案可能是数据模型包括每个用户是否被确认。似乎添加了:

confirmation_token, confirmed_at, confirmation_sent_at

此外,confirmable 模块似乎添加了这些方法:

:confirmation_token, :confirmation_token=, :confirmation_token?, :confirmation_token_change, :confirmation_token_changed?, :confirmation_token_was, :reset_confirmation_token!, :confirmed_at, :confirmed_at=, :confirmed_at?, :confirmed_at_change, :confirmed_at_changed?, :confirmed_at_was, :reset_confirmed_at!, :confirmation_sent_at, :confirmation_sent_at=, :confirmation_sent_at?, :confirmation_sent_at_change, :confirmation_sent_at_changed?, :confirmation_sent_at_was, :reset_confirmation_sent_at!

所以你可以在数据模型层完成它。我正在使用 Mongoid,所以我只是编写了一个脚本,将每个用户的confirmed_at 更改为今天。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 Devise 将可确认的模块添加到现有站点 的相关文章

随机推荐