Fixed an issue where the 2FA window redirected to the login page after session expiration. #9132

This commit is contained in:
Pravesh Sharma
2025-10-31 11:17:04 +05:30
committed by GitHub
parent 7251c1f628
commit 08379d6ae0
+10 -3
View File
@@ -283,7 +283,6 @@ def __handle_registration_view_for_post_method(
@pgCSRFProtect.exempt
@login_required
def registration_view() -> Response:
"""
A url end-point to register/deregister an authentication method.
@@ -310,11 +309,19 @@ def registration_view() -> Response:
Response: A response object with list of auth methods, a registration
view, or redirect to 'next' url
"""
next_url = request.args.get("next", None)
if not current_user.is_authenticated:
flash(_("Session expired. Please refresh the page."),
MessageType.ERROR)
return Response(render_template(
'mfa/register.html', _=_,
mfa_list=[], mfa_view=None, next_url=next_url,
error_message=None,
))
mfa_auths = mfa_suppored_methods()
mfa_list = list()
next_url = request.args.get("next", None)
if request.method == 'POST':
next_url, response, mfa_auths = \
__handle_registration_view_for_post_method(next_url, mfa_auths)