Devise “Confirmation token is invalid” when user signs up

前端 未结 3 1830
感动是毒
感动是毒 2020-12-09 00:47

Using Rails 4 and Devise 3.1.0 on my web app. I wrote a Cucumber test to test user sign up; it fails when the \"confirm my account\" link is clicked from the e-mail.

3条回答
  •  旧时难觅i
    2020-12-09 01:35

    So upgrading to Devise 3.1.0 left some 'cruft' in a view that I hadn't touched in a while.

    According to this blog post, you need to change your Devise mailer to use @token instead of the old @resource.confirmation_token.

    Find this in app/views//mailer/confirmation_instructions.html.erb and change it to something like:

    Welcome <%= @resource.email %>!

    You can confirm your account email through the link below:

    <%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @token) %>

    This should fix any token-based confirmation problems you're having. This is likely to fix any unlock or reset password token problems as well.

提交回复
热议问题