在设备3.1中返回设备确认令牌 [英] Return devise confirmation token in device 3.1

查看:116
本文介绍了在设备3.1中返回设备确认令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在Devise已经从数据库中删除了confirm_token,我如何在rspec中返回设计确认令牌?

Now that Devise has removed the :confirmation_token from the database, how can I return the devise confirmation token in rspec?

我正在尝试使用确认令牌手动访问user_confirmation路径来测试可确认的模块。如何实现?

I am trying to test the confirmable module by manually visiting the user_confirmation path with the confirmation token. How can I achieve this?

推荐答案

确认流程已更改。现在,确认流程使用User.confirm_by_token。你可以这样做:

The confirmation flow has changed. Now, the confirmation flow uses User.confirm_by_token. You can do something like this:

old_token = User.last.confirmation_token
new_token = Devise.token_generator.digest(User, :confirmation_token, old_token)
User.last.update_attribute(:confirmation_token, new_token)
visit user_confirmation_url(confirmation_token: old_token)

这篇关于在设备3.1中返回设备确认令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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