diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-01-17 14:51:29 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-01-17 14:51:29 +0000 |
commit | a3a8fee8adf847f08479cf6b860417fe1f36d791 (patch) | |
tree | d40a5e442c092f27b9aa49636f5bf28d8fa5daf7 /app/controllers/account_controller.rb | |
parent | 14473f45a16a945d22b6b0f768393057ffd0245c (diff) | |
download | redmine-a3a8fee8adf847f08479cf6b860417fe1f36d791.tar.gz redmine-a3a8fee8adf847f08479cf6b860417fe1f36d791.zip |
Send password reset email to the email used in lost password form (#4244).
git-svn-id: http://svn.redmine.org/redmine/trunk@13888 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/account_controller.rb')
-rw-r--r-- | app/controllers/account_controller.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 77058ea5c..2ad7af610 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -82,7 +82,8 @@ class AccountController < ApplicationController return else if request.post? - user = User.find_by_mail(params[:mail].to_s) + email = params[:mail].to_s + user = User.find_by_mail(email) # user not found unless user flash.now[:error] = l(:notice_account_unknown_email) @@ -100,7 +101,9 @@ class AccountController < ApplicationController # create a new token for password recovery token = Token.new(:user => user, :action => "recovery") if token.save - Mailer.lost_password(token).deliver + # Don't use the param to send the email + recipent = user.mails.detect {|e| e.downcase == email.downcase} || user.mail + Mailer.lost_password(token, recipent).deliver flash[:notice] = l(:notice_account_lost_email_sent) redirect_to signin_path return |