Fix an issue where changing MFA_SUPPORTED_METHODS breaks the MFA validation. #6624

This commit is contained in:
Aditya Toshniwal 2023-07-31 15:02:30 +05:30
parent 9ab36b0269
commit 2aea5b41ad
2 changed files with 7 additions and 2 deletions

View File

@ -3,7 +3,7 @@
'actionUrl': url_for('mfa.validate'),
'views': views,
'logoutUrl': logout_url,
'sendEmailUrl': url_for("mfa.send_email_code"),
'sendEmailUrl': send_email_url,
'csrfHeader': current_app.config.get("WTF_CSRF_HEADERS")[0],
'csrfToken': csrf_token()
} %}

View File

@ -134,9 +134,14 @@ def validate_view() -> Response:
if mfa_method is None and len(mfa_views) > 0:
list(mfa_views.items())[0][1]['selected'] = True
send_email_url = None
if 'email' in mfa_views:
send_email_url = url_for("mfa.send_email_code")
return Response(render_template(
"mfa/validate.html", _=_, views=mfa_views, base64=base64,
logout_url=get_logout_url()
logout_url=get_logout_url(),
send_email_url=send_email_url
), return_code, headers=_NO_CACHE_HEADERS, mimetype="text/html")