mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-10 08:04:36 -06:00
Fixed an issue where the user unable to login with OAuth2 when LDAP & OAuth2 configured as login sources. Fixes #6594
This commit is contained in:
parent
e981868246
commit
3590c9172c
@ -75,13 +75,15 @@ def login():
|
||||
return redirect(get_post_logout_redirect())
|
||||
session['auth_source_manager'] = current_auth_obj
|
||||
if 'auth_obj' in session:
|
||||
session['auth_obj'] = None
|
||||
session.pop('auth_obj')
|
||||
return redirect(get_post_login_redirect())
|
||||
|
||||
elif isinstance(msg, Response):
|
||||
return msg
|
||||
elif 'oauth2_button' in request.form and not isinstance(msg, str):
|
||||
return msg
|
||||
if 'auth_obj' in session:
|
||||
session.pop('auth_obj')
|
||||
flash(msg, 'danger')
|
||||
response = redirect(get_post_logout_redirect())
|
||||
return response
|
||||
@ -116,8 +118,11 @@ class AuthSourceManager:
|
||||
if auth_src in self.auth_sources:
|
||||
if 'internal_button' in request.form:
|
||||
self.auth_sources.remove(auth_src)
|
||||
elif INTERNAL in self.auth_sources:
|
||||
else:
|
||||
if INTERNAL in self.auth_sources:
|
||||
self.auth_sources.remove(INTERNAL)
|
||||
if LDAP in self.auth_sources:
|
||||
self.auth_sources.remove(LDAP)
|
||||
|
||||
def set_current_source(self, source):
|
||||
self.current_source = source
|
||||
|
@ -56,9 +56,11 @@ def init_app(app):
|
||||
status, msg = auth_obj.login()
|
||||
if status:
|
||||
session['auth_source_manager'] = auth_obj.as_dict()
|
||||
session['auth_obj'] = None
|
||||
if 'auth_obj' in session:
|
||||
session.pop('auth_obj')
|
||||
return redirect(get_post_login_redirect())
|
||||
session['auth_obj'] = None
|
||||
if 'auth_obj' in session:
|
||||
session.pop('auth_obj')
|
||||
logout_user()
|
||||
flash(msg, 'danger')
|
||||
return redirect(get_post_login_redirect())
|
||||
|
Loading…
Reference in New Issue
Block a user