Rails + Devise: "Reset password token is invalid" on password reset

I have been experiencing this strange error in the production version of my rails site for a while. This does not happen locally, which disappoints my debugging efforts.

I followed the recommendations made in the following SO questions:

Upgrade for development 3.1 => receiving Reset password token is invalid Rails 4 + Devise: Password Reset always indicates "Invalid token." error on the production server, but it works fine locally.

In particular, changing my file reset_password_instructions.html.erbto:

<p>Hello <%= @resource.email %>!</p>

<p>Someone has requested a link to change your password. You can do this through the link below.</p>

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

<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>

I use the following gems:

devise (3.5.9)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 3.2.6, < 5)
      responders
      thread_safe (~> 0.1)
      warden (~> 1.2.3)

, " ", Reset ( XYZ123 Rails Console).

Rails Console (Devise:: TokenGenerator.new) Devise, (raw), Reset, . , "User.find_or_initialize_with_error_by" rails , , . , , , , , , .

- , ? , URL-, - Reset, :

http://www.WEBSITE.com/users/password/edit.<USER_ID>?reset_password_token=<CORRECT_RAW_RESET_PASSWORD_TOKEN>?reset_password_token=<CORRECT_RAW_RESET_PASSWORD_TOKEN>

, reset_password_token - , Gmail, .

+4

All Articles