diff --git a/app/controllers/passwords_controller.rb b/app/controllers/passwords_controller.rb index fbb9d371a79..145f27b67dd 100644 --- a/app/controllers/passwords_controller.rb +++ b/app/controllers/passwords_controller.rb @@ -52,7 +52,7 @@ class PasswordsController < Devise::PasswordsController unless user.reset_password_period_valid? flash[:alert] = 'Your password reset token has expired.' - redirect_to(new_user_password_url) + redirect_to(new_user_password_url(user_email: user['email'])) end end end diff --git a/app/helpers/emails_helper.rb b/app/helpers/emails_helper.rb index 12aa561a14e..128de18bc47 100644 --- a/app/helpers/emails_helper.rb +++ b/app/helpers/emails_helper.rb @@ -50,7 +50,7 @@ module EmailsHelper end def reset_token_expire_message - link_tag = link_to('request a new one', new_user_password_url) + link_tag = link_to('request a new one', new_user_password_url(user_email: @user.email)) msg = "This link is valid for #{password_reset_token_valid_time}. " msg << "After it expires, you can #{link_tag}." end diff --git a/app/views/devise/passwords/new.html.haml b/app/views/devise/passwords/new.html.haml index e8820daf58f..29ffe8a8be3 100644 --- a/app/views/devise/passwords/new.html.haml +++ b/app/views/devise/passwords/new.html.haml @@ -6,7 +6,7 @@ .devise-errors = devise_error_messages! .clearfix.append-bottom-20 - = f.email_field :email, placeholder: "Email", class: "form-control", required: true + = f.email_field :email, placeholder: "Email", class: "form-control", required: true, value: params[:user_email] .clearfix = f.submit "Reset password", class: "btn-primary btn" diff --git a/app/views/notify/new_user_email.html.haml b/app/views/notify/new_user_email.html.haml index 39cb01d4d29..4feacdaacff 100644 --- a/app/views/notify/new_user_email.html.haml +++ b/app/views/notify/new_user_email.html.haml @@ -11,6 +11,6 @@ - if @user.created_by_id %p - = link_to "Click here to set your password", edit_password_url(@user, :reset_password_token => @token) + = link_to "Click here to set your password", edit_password_url(@user, reset_password_token: @token) %p = reset_token_expire_message