在密码重置时设计Token Auth需要current_password

时间:2016-02-06 02:29:02

标签: ruby-on-rails devise devise-confirmable http-token-authentication devise-recoverable

我启用了config.check_current_password_before_update = :password。因此,当用户更新他/她的密码时,需要current_password字段。这在实现password reset时成为问题,因为用户不知道他/她当前的密码。当用户没有重置他/她的密码时,如何绕过这个并仍然需要current_password

除此之外,一切正常,电子邮件发送,/password/edit返回仅为一个会话启用的正确令牌,但current_password要求没有任何意义。如果我把它拿走,那么重置密码就可以了,但是如果用户试图更新他/她的密码,那么应用程序不允许这样做并给出ActiveRecord::UnknownAttributeError (unknown attribute 'current_password' for User.):,因为它将其视为用户属性。

有谁知道如何在工作流程中解决这个问题?

0 个答案:

没有答案
相关问题