mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-11 17:38:50 -04:00
Merge pull request #3432 from alphagov/add-use-endpoint
Add a second URL for the email auth endpoint
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user