Commit 802d584d82ca1abd23fb423a5e307ce2036585d3
1 parent
f965f382
Exists in
master
and in
1 other branch
Set email field on password reset page to the email that user entered on this page
Showing
2 changed files
with
13 additions
and
5 deletions
Show diff stats
app/views/devise/passwords/new.html.haml
... | ... | @@ -3,6 +3,7 @@ |
3 | 3 | = errors_for resource |
4 | 4 | .required |
5 | 5 | = f.label :email |
6 | - = f.text_field :email | |
7 | - | |
8 | - %div.buttons= f.submit "Send me reset password instructions" | |
9 | 6 | \ No newline at end of file |
7 | + = f.text_field :email, :value => params[:email] | |
8 | + | |
9 | + %div.buttons= f.submit "Send me reset password instructions" | |
10 | + | ... | ... |
app/views/devise/sessions/new.html.haml
1 | 1 | - content_for :title, 'Sign in' |
2 | +- auth_key = Devise.authentication_keys.first | |
2 | 3 | |
3 | 4 | = form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| |
4 | - - auth_key = Devise.authentication_keys.first | |
5 | 5 | .required |
6 | 6 | = f.label auth_key |
7 | 7 | = f.text_field auth_key, :tabindex => 1 |
8 | 8 | |
9 | 9 | .required |
10 | - = link_to 'forget it?', new_password_path(resource_name), :class => 'float-right' | |
10 | + = link_to 'forget it?', new_password_path(resource_name), :class => 'float-right', :id => "forgot_password" | |
11 | 11 | = f.label :password |
12 | 12 | = f.password_field :password, :tabindex => 2 |
13 | 13 | |
... | ... | @@ -19,3 +19,10 @@ |
19 | 19 | %div.buttons |
20 | 20 | %button{:type => 'submit', :class => 'sign_in'}= "Sign in" |
21 | 21 | |
22 | +:javascript | |
23 | + $('a#forgot_password').click(function(){ | |
24 | + // Set email field on password reset page to email that user entered on this page | |
25 | + location.href = $(this).attr('href') + "?email=" + $('#user_#{auth_key}').val(); | |
26 | + return false; | |
27 | + }); | |
28 | + | ... | ... |