From 7d352654fd4d76ea6314076c8bc9816fe77ffc74 Mon Sep 17 00:00:00 2001 From: Dan Milne Date: Sat, 2 May 2026 23:40:43 +1000 Subject: [PATCH] Fix broken password reset email templates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both templates called `@user.password_reset_token` and `@user.password_reset_token_expires_in`, which don't exist — `generates_token_for` only adds class-level helpers, not instance accessors. Every password reset email was failing at render time. Use `generate_token_for(:password_reset)` and a literal expiry string matching the 1-hour TTL on the token. Co-Authored-By: Claude Opus 4.7 (1M context) --- app/views/passwords_mailer/reset.html.erb | 4 ++-- app/views/passwords_mailer/reset.text.erb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/passwords_mailer/reset.html.erb b/app/views/passwords_mailer/reset.html.erb index 1b09154..3cabe23 100644 --- a/app/views/passwords_mailer/reset.html.erb +++ b/app/views/passwords_mailer/reset.html.erb @@ -1,6 +1,6 @@

You can reset your password on - <%= link_to "this password reset page", edit_password_url(@user.password_reset_token) %>. + <%= link_to "this password reset page", edit_password_url(@user.generate_token_for(:password_reset)) %>. - This link will expire in <%= distance_of_time_in_words(0, @user.password_reset_token_expires_in) %>. + This link will expire in 1 hour.

diff --git a/app/views/passwords_mailer/reset.text.erb b/app/views/passwords_mailer/reset.text.erb index aecee82..43ec762 100644 --- a/app/views/passwords_mailer/reset.text.erb +++ b/app/views/passwords_mailer/reset.text.erb @@ -1,4 +1,4 @@ You can reset your password on -<%= edit_password_url(@user.password_reset_token) %> +<%= edit_password_url(@user.generate_token_for(:password_reset)) %> -This link will expire in <%= distance_of_time_in_words(0, @user.password_reset_token_expires_in) %>. +This link will expire in 1 hour.