Merge pull request #3432 from alphagov/add-use-endpoint

Add a second URL for the email auth endpoint
This commit is contained in:
Chris Hill-Scott
2020-05-04 15:45:51 +01:00
committed by GitHub
2 changed files with 6 additions and 2 deletions

View File

@@ -28,7 +28,7 @@ def two_factor_email_sent():
)
@main.route('/email-auth/<token>', methods=['GET'])
@main.route('/email-auth/<token>', methods=['GET', 'POST'])
def two_factor_email(token):
if current_user.is_authenticated:
return redirect_when_logged_in(platform_admin=current_user.platform_admin)

View File

@@ -253,6 +253,9 @@ def test_two_factor_should_activate_pending_user(
assert mock_activate_user.called
@pytest.mark.parametrize('http_method', (
'get', 'post',
))
def test_valid_two_factor_email_link_logs_in_user(
client,
valid_token,
@@ -260,10 +263,11 @@ def test_valid_two_factor_email_link_logs_in_user(
mock_get_services_with_one_service,
mocker,
mock_create_event,
http_method,
):
mocker.patch('app.user_api_client.check_verify_code', return_value=(True, ''))
response = client.get(
response = getattr(client, http_method)(
url_for_endpoint_with_token('main.two_factor_email', token=valid_token),
)