Fixed intermittent error shown while OAuth2 login

This commit is contained in:
Yogesh Mahajan
2022-09-23 13:58:02 +05:30
committed by GitHub
parent 9a6516a8b3
commit f052ecffc0
2 changed files with 7 additions and 3 deletions

View File

@@ -67,12 +67,15 @@ def login():
The user input will be validated and authenticated.
"""
form = _security.login_form()
auth_obj = AuthSourceManager(form, copy.deepcopy(
config.AUTHENTICATION_SOURCES))
if OAUTH2 in config.AUTHENTICATION_SOURCES \
and 'oauth2_button' in request.form:
# Sending empty form as oauth2 does not require form attribute
auth_obj = AuthSourceManager({}, copy.deepcopy(
config.AUTHENTICATION_SOURCES))
session['auth_obj'] = auth_obj
else:
auth_obj = AuthSourceManager(form, copy.deepcopy(
config.AUTHENTICATION_SOURCES))
session['auth_source_manager'] = None