diff --git a/app/main/views/sign_in.py b/app/main/views/sign_in.py index 8721c7451..fc8e9b049 100644 --- a/app/main/views/sign_in.py +++ b/app/main/views/sign_in.py @@ -30,6 +30,9 @@ def sign_in(): return redirect(url_for('main.choose_service')) form = LoginForm() + if form.email_address.data: + form.email_address.data = form.email_address.data.strip() + if form.validate_on_submit(): user = user_api_client.get_user_by_email_or_none(form.email_address.data) diff --git a/app/templates/views/signedout.html b/app/templates/views/signedout.html index 0ec9f1878..05bde1b5e 100644 --- a/app/templates/views/signedout.html +++ b/app/templates/views/signedout.html @@ -120,12 +120,12 @@

Services

-
117
+
119
services

Organisations

-
50
+
51
organisations
diff --git a/requirements.txt b/requirements.txt index 455683a0d..5f7fcadd0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,7 +7,7 @@ boto3==1.4.8 blinker==1.4 pyexcel==0.5.6 pyexcel-io==0.5.4 -pyexcel-xls==0.5.4 +pyexcel-xls==0.5.5 pyexcel-xlsx==0.5.4 pyexcel-ods3==0.5.2 pytz==2017.3 diff --git a/tests/app/main/views/test_sign_in.py b/tests/app/main/views/test_sign_in.py index 97b1956ac..dc9d4da29 100644 --- a/tests/app/main/views/test_sign_in.py +++ b/tests/app/main/views/test_sign_in.py @@ -77,6 +77,10 @@ def test_logged_in_user_redirects_to_choose_service( assert response.location == url_for('main.choose_service', _external=True) +@pytest.mark.parametrize('email_address', [ + 'valid@example.gov.uk', + ' valid@example.gov.uk ', +]) def test_process_sms_auth_sign_in_return_2fa_template( client, api_user_active, @@ -84,14 +88,16 @@ def test_process_sms_auth_sign_in_return_2fa_template( mock_get_user, mock_get_user_by_email, mock_verify_password, + email_address, ): response = client.post( url_for('main.sign_in'), data={ - 'email_address': 'valid@example.gov.uk', + 'email_address': email_address, 'password': 'val1dPassw0rd!'}) assert response.status_code == 302 assert response.location == url_for('.two_factor', _external=True) mock_verify_password.assert_called_with(api_user_active.id, 'val1dPassw0rd!') + mock_get_user_by_email.assert_called_with('valid@example.gov.uk') def test_process_email_auth_sign_in_return_2fa_template(