Commit af428b12 authored by Vinnie Okada's avatar Vinnie Okada

Fill in email on the new password form

parent c68c2321
...@@ -52,7 +52,7 @@ class PasswordsController < Devise::PasswordsController ...@@ -52,7 +52,7 @@ class PasswordsController < Devise::PasswordsController
unless user.reset_password_period_valid? unless user.reset_password_period_valid?
flash[:alert] = 'Your password reset token has expired.' 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 end
end end
......
...@@ -50,7 +50,7 @@ module EmailsHelper ...@@ -50,7 +50,7 @@ module EmailsHelper
end end
def reset_token_expire_message 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 = "This link is valid for #{password_reset_token_valid_time}. "
msg << "After it expires, you can #{link_tag}." msg << "After it expires, you can #{link_tag}."
end end
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
.devise-errors .devise-errors
= devise_error_messages! = devise_error_messages!
.clearfix.append-bottom-20 .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 .clearfix
= f.submit "Reset password", class: "btn-primary btn" = f.submit "Reset password", class: "btn-primary btn"
......
...@@ -11,6 +11,6 @@ ...@@ -11,6 +11,6 @@
- if @user.created_by_id - if @user.created_by_id
%p %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 %p
= reset_token_expire_message = reset_token_expire_message
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment