Project

General

Profile

Defect #27754 » 27754.patch

Felix Schäfer, 2017-12-07 12:25

View differences:

app/controllers/account_controller.rb
98 98
      return
99 99
    else
100 100
      if request.post?
101
        email = params[:mail].to_s
101
        email = params[:mail].to_s.strip
102 102
        user = User.find_by_mail(email)
103 103
        # user not found
104 104
        unless user
test/functional/account_controller_test.rb
385 385
    end
386 386
  end
387 387

  
388
  def test_lost_password_with_whitespace_should_send_email_to_the_address
389
    Token.delete_all
390

  
391
    assert_difference 'ActionMailer::Base.deliveries.size' do
392
      assert_difference 'Token.count' do
393
        post :lost_password, params: {
394
          mail: ' JSmith@somenet.foo  '
395
        }
396
        assert_redirected_to '/login'
397
      end
398
    end
399
    mail = ActionMailer::Base.deliveries.last
400
    assert_equal ['jsmith@somenet.foo'], mail.bcc
401
  end
402

  
388 403
  def test_lost_password_using_additional_email_address_should_send_email_to_the_address
389 404
    EmailAddress.create!(:user_id => 2, :address => 'anotherAddress@foo.bar')
390 405
    Token.delete_all
    (1-1/1)