设计确认重新发送“登录不能为空”错误&来自电子邮件的确认链接具有“确认令牌无效”错误 [英] Devise Confirmation Resend "Login can't be blank" error & Confirmation link from email has "Confirmation token is invalid" error

查看:866
本文介绍了设计确认重新发送“登录不能为空”错误&来自电子邮件的确认链接具有“确认令牌无效”错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ruby​​'1.9.3'

ruby '1.9.3'

rails,3.2.13

"rails", "3.2.13"

devise ,'〜> 3.2.2'

"devise", '~> 3.2.2'

我正在使用Devise确认控制器,无需修改。我创建一个用户,并发送电子邮件。然后单击链接以确认确认令牌无效中的结果。电子邮件中的令牌与数据库中的令牌相同。

I'm using the Devise confirmation controller without modification. I create a user and the email is sent. Then clicking on the link to confirm results in "Confirmation token is invalid". The token in the email is the same as in the database.

此外,当用户处于注册编辑时,我提供了一个链接来重新发送确认电子邮件。这将使用户进入确认新建,然后填写电子邮件,然后单击重新发送确认说明按钮,并收到错误登录不能为空。用户登录,否则他们将无法访问用户/编辑或用户/确认/新的。

Also when the user is in Registrations edit I provided a link to resend the confirmation email. This brings the user to Confirmations New and you fill in the email and click the "Resend Confirmation instructions" button and receive the error "Login can't be blank." The user is logged in, otherwise they would not be able to get to users/edit or users/confirmation/new.

我已配置设计接受用户名或电子邮件用于登录。

I have configured devise to accept a user_name or email for login.

推荐答案

在密码重置期间,确保对特定密码更改时,resent_password_sent_at列与用户记录必须设置为Time.now / time正在发送令牌。

During password reset ensure resent_password_sent_at column against user record must be set to Time.now /time when particular password change token is being sent.

raw, enc = Devise.token_generator.generate(@user.class, :reset_password_token)
@user.update_attributes(reset_password_token: enc, reset_password_sent_at: Time.now)

这篇关于设计确认重新发送“登录不能为空”错误&来自电子邮件的确认链接具有“确认令牌无效”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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