mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-06 03:13:42 -05:00
Merge branch 'main' of https://github.com/GSA/notifications-admin into 533-adjust-uswds-styles
This commit is contained in:
@@ -52,7 +52,7 @@ def two_factor_email(token):
|
||||
token,
|
||||
current_app.config['SECRET_KEY'],
|
||||
current_app.config['DANGEROUS_SALT'],
|
||||
current_app.config['EMAIL_2FA_EXPIRY_SECONDS']
|
||||
current_app.config['EMAIL_EXPIRY_SECONDS']
|
||||
))
|
||||
except SignatureExpired:
|
||||
return render_template('views/email-link-invalid.html', redirect_url=redirect_url)
|
||||
|
||||
@@ -3,23 +3,19 @@
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
|
||||
{% block per_page_title %}
|
||||
Sign in
|
||||
Click below to complete email re-verification and finish signing in.
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
<div class="js-hidden">
|
||||
<div>
|
||||
|
||||
{{ page_header('Sign in') }}
|
||||
<h1 class="font-body-2xl margin-bottom-3">Click below to complete email re-verification and finish signing in.</h1>
|
||||
|
||||
<form method="post" id="use-email-auth">
|
||||
{{ page_footer('Continue to dashboard') }}
|
||||
{{ page_footer('Verify email') }}
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
document.getElementById("use-email-auth").submit();
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
|
||||
{% block per_page_title %}
|
||||
Invalid email link
|
||||
This link has expired
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
<div class="govuk-grid-row">
|
||||
<div class="govuk-grid-column-two-thirds">
|
||||
<h1 class="font-body-2xl margin-bottom-3">The link has expired</h1>
|
||||
<h1 class="font-body-2xl margin-bottom-3">This link has expired</h1>
|
||||
|
||||
<p>
|
||||
<a class="govuk-link govuk-link--no-visited-state" href="{{ url_for('main.sign_in', next=redirect_url) }}">
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<div class="govuk-grid-column-two-thirds">
|
||||
<h1 class="font-body-2xl margin-bottom-3">{{ title }}</h1>
|
||||
<p>For security, we need to check if you still have access to your email address.</p>
|
||||
<p>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>
|
||||
<p>We’ve sent you a link valid for 1 hour 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', next=redirect_url),
|
||||
|
||||
@@ -390,9 +390,9 @@ def test_valid_two_factor_email_link_shows_interstitial(
|
||||
client_request.logout()
|
||||
page = client_request.get_url(token_url)
|
||||
|
||||
assert normalize_spaces(page.select_one('main .js-hidden').text) == (
|
||||
'Sign in '
|
||||
'Continue to dashboard'
|
||||
assert normalize_spaces(page.select_one('main').text) == (
|
||||
'Click below to complete email re-verification and finish signing in. '
|
||||
'Verify email'
|
||||
)
|
||||
|
||||
form = page.select_one('form')
|
||||
@@ -400,9 +400,6 @@ def test_valid_two_factor_email_link_shows_interstitial(
|
||||
assert 'action' not in form
|
||||
assert form['method'] == 'post'
|
||||
assert form['id'] == expected_form_id
|
||||
assert page.select_one('main script').string.strip() == (
|
||||
f'document.getElementById("{expected_form_id}").submit();'
|
||||
)
|
||||
|
||||
assert mock_check_code.called is False
|
||||
|
||||
@@ -437,13 +434,13 @@ def test_two_factor_email_link_has_expired(
|
||||
):
|
||||
client_request.logout()
|
||||
|
||||
with set_config(notify_admin, 'EMAIL_2FA_EXPIRY_SECONDS', -1):
|
||||
with set_config(notify_admin, 'EMAIL_EXPIRY_SECONDS', -1):
|
||||
page = client_request.post_url(
|
||||
url_for_endpoint_with_token('main.two_factor_email', token=valid_token, next=redirect_url),
|
||||
_follow_redirects=True,
|
||||
)
|
||||
|
||||
assert page.h1.text.strip() == 'The link has expired'
|
||||
assert page.h1.text.strip() == 'This link has expired'
|
||||
assert page.select_one('a:contains("Sign in again")')['href'] == url_for('main.sign_in', next=redirect_url)
|
||||
|
||||
assert mock_send_verify_code.called is False
|
||||
@@ -486,7 +483,7 @@ def test_two_factor_email_link_is_already_used(
|
||||
_follow_redirects=True,
|
||||
)
|
||||
|
||||
assert page.h1.text.strip() == 'The link has expired'
|
||||
assert page.h1.text.strip() == 'This link has expired'
|
||||
assert page.select_one('a:contains("Sign in again")')['href'] == url_for('main.sign_in', next=redirect_url)
|
||||
|
||||
assert mock_send_verify_code.called is False
|
||||
@@ -506,7 +503,7 @@ def test_two_factor_email_link_when_user_is_locked_out(
|
||||
_follow_redirects=True,
|
||||
)
|
||||
|
||||
assert page.h1.text.strip() == 'The link has expired'
|
||||
assert page.h1.text.strip() == 'This link has expired'
|
||||
assert mock_send_verify_code.called is False
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user