diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index c300457b5..2263ad07f 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -89,7 +89,8 @@ class AccountController < ApplicationController @user.must_change_passwd = false if @user.save @token.destroy - Mailer.deliver_password_updated(@user, User.current) + @user.remote_ip = request.remote_ip + Mailer.deliver_password_updated(@user, @user) flash[:notice] = l(:notice_account_password_updated) redirect_to signin_path return diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb index cac90bedb..ccd0c7050 100644 --- a/test/functional/account_controller_test.rb +++ b/test/functional/account_controller_test.rb @@ -579,7 +579,8 @@ class AccountControllerTest < Redmine::ControllerTest user.reload assert user.check_password?('newpass123') assert_nil Token.find_by_id(token.id), "Token was not deleted" - assert_not_nil ActionMailer::Base.deliveries.last + assert_not_nil (mail = ActionMailer::Base.deliveries.last) + assert_mail_body_match '0.0.0.0', mail assert_select_email do assert_select 'a[href^=?]', 'http://localhost:3000/my/password', :text => 'Change password' end