From aae275b4c65dd283dea25aa05d6f97f09732caa5 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Sat, 9 Dec 2017 02:43:09 +0000 Subject: [PATCH] Merged r17078 to 3.4-stable (#27754). git-svn-id: http://svn.redmine.org/redmine/branches/3.4-stable@17079 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/account_controller.rb | 2 +- test/functional/account_controller_test.rb | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 7f51343dd..d6e1da885 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -98,7 +98,7 @@ class AccountController < ApplicationController return else if request.post? - email = params[:mail].to_s + email = params[:mail].to_s.strip user = User.find_by_mail(email) # user not found unless user diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb index 7850a9a0d..d25a00331 100644 --- a/test/functional/account_controller_test.rb +++ b/test/functional/account_controller_test.rb @@ -385,6 +385,21 @@ class AccountControllerTest < Redmine::ControllerTest end end + def test_lost_password_with_whitespace_should_send_email_to_the_address + Token.delete_all + + assert_difference 'ActionMailer::Base.deliveries.size' do + assert_difference 'Token.count' do + post :lost_password, params: { + mail: ' JSmith@somenet.foo ' + } + assert_redirected_to '/login' + end + end + mail = ActionMailer::Base.deliveries.last + assert_equal ['jsmith@somenet.foo'], mail.bcc + end + def test_lost_password_using_additional_email_address_should_send_email_to_the_address EmailAddress.create!(:user_id => 2, :address => 'anotherAddress@foo.bar') Token.delete_all