mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-28 09:59:59 -04:00
Turn on redirects revalidate_email_sent
This is part of the work to make sure user is redirected to the page they initially were meant to visit after they sign in.
This commit is contained in:
@@ -85,7 +85,8 @@ def two_factor():
|
||||
@main.route('/re-validate-email', methods=['GET'])
|
||||
def revalidate_email_sent():
|
||||
title = 'Email resent' if request.args.get('email_resent') else 'Check your email'
|
||||
return render_template('views/re-validate-email-sent.html', title=title)
|
||||
redirect_url = request.args.get('next')
|
||||
return render_template('views/re-validate-email-sent.html', title=title, redirect_url=redirect_url)
|
||||
|
||||
|
||||
# see http://flask.pocoo.org/snippets/62/
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<p class="govuk-body">We’ve sent you a link to sign in to Notify. The link will open in a new browser window, so you can close this one.</p>
|
||||
|
||||
{{ page_footer(
|
||||
secondary_link=url_for('main.email_not_received'),
|
||||
secondary_link=url_for('main.email_not_received', next=redirect_url),
|
||||
secondary_link_text='Not received an email?'
|
||||
) }}
|
||||
</div>
|
||||
|
||||
@@ -11,10 +11,8 @@ from tests.conftest import (
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('redirect_url', [
|
||||
None,
|
||||
'blob',
|
||||
])
|
||||
@pytest.mark.parametrize('request_url', ['two_factor_email_sent', 'revalidate_email_sent'])
|
||||
@pytest.mark.parametrize('redirect_url', [None, 'blob'])
|
||||
@pytest.mark.parametrize('email_resent, page_title', [
|
||||
(None, 'Check your email'),
|
||||
(True, 'Email resent')
|
||||
@@ -23,9 +21,10 @@ def test_two_factor_email_sent_page(
|
||||
client,
|
||||
email_resent,
|
||||
page_title,
|
||||
redirect_url
|
||||
redirect_url,
|
||||
request_url
|
||||
):
|
||||
response = client.get(url_for('main.two_factor_email_sent', next=redirect_url, email_resent=email_resent))
|
||||
response = client.get(url_for(f'main.{request_url}', next=redirect_url, email_resent=email_resent))
|
||||
assert response.status_code == 200
|
||||
|
||||
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||
|
||||
Reference in New Issue
Block a user