Upgrading to devise 3.1 => getting Reset password token is invalid

前端 未结 6 2307
隐瞒了意图╮
隐瞒了意图╮ 2020-12-15 02:53

Solution

Thanks to this gist form Steven Harman, I got it working. devise_mail_helpers.rb

module Features
  module MailHelpers

             


        
6条回答
  •  盖世英雄少女心
    2020-12-15 03:32

    You commented on my similar question a bit ago, and I found an answer that might help you as well.

    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/reset_password_instructions.html.erb and change it to something like:

    Hello <%= @resource.email %>!

    Someone has requested a link to change your password, and you can do this through the link below.

    <%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @token) %>

    If you didn't request this, please ignore this email.

    Your password won't change until you access the link above and create a new one.

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

提交回复
热议问题