mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-05 16:38:59 -04:00
Turn on redirects two_factor_email
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:
@@ -36,6 +36,7 @@ def two_factor_email_interstitial(token):
|
||||
|
||||
@main.route('/email-auth/<token>', methods=['POST'])
|
||||
def two_factor_email(token):
|
||||
redirect_url = request.args.get('next')
|
||||
if current_user.is_authenticated:
|
||||
return redirect_when_logged_in(platform_admin=current_user.platform_admin)
|
||||
|
||||
@@ -48,14 +49,14 @@ def two_factor_email(token):
|
||||
current_app.config['EMAIL_2FA_EXPIRY_SECONDS']
|
||||
))
|
||||
except SignatureExpired:
|
||||
return render_template('views/email-link-invalid.html')
|
||||
return render_template('views/email-link-invalid.html', redirect_url=redirect_url)
|
||||
|
||||
user_id = token_data['user_id']
|
||||
# checks if code was already used
|
||||
logged_in, msg = user_api_client.check_verify_code(user_id, token_data['secret_code'], "email")
|
||||
|
||||
if not logged_in:
|
||||
return render_template('views/email-link-invalid.html')
|
||||
return render_template('views/email-link-invalid.html', redirect_url=redirect_url)
|
||||
return log_in_user(user_id)
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,11 @@
|
||||
<div class="govuk-grid-column-two-thirds">
|
||||
<h1 class="heading-large">The link has expired</h1>
|
||||
|
||||
<p class="govuk-body"><a class="govuk-link govuk-link--no-visited-state" href="{{ url_for('main.sign_in') }}">Sign in again</a> to get a new link.</p>
|
||||
<p class="govuk-body">
|
||||
<a class="govuk-link govuk-link--no-visited-state" href="{{ url_for('main.sign_in', next=redirect_url) }}">
|
||||
Sign in again
|
||||
</a> to get a new link.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user