mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Informative error should be shown if Oauth2 profile does not have email id registered. Fixes #6590
This commit is contained in:
parent
36086722b3
commit
5ee8045916
@ -58,8 +58,9 @@ def init_app(app):
|
|||||||
session['auth_source_manager'] = auth_obj.as_dict()
|
session['auth_source_manager'] = auth_obj.as_dict()
|
||||||
session['auth_obj'] = None
|
session['auth_obj'] = None
|
||||||
return redirect(get_post_login_redirect())
|
return redirect(get_post_login_redirect())
|
||||||
|
session['auth_obj'] = None
|
||||||
logout_user()
|
logout_user()
|
||||||
flash(msg)
|
flash(msg, 'danger')
|
||||||
return redirect(get_post_login_redirect())
|
return redirect(get_post_login_redirect())
|
||||||
|
|
||||||
@blueprint.route('/logout', endpoint="logout",
|
@blueprint.route('/logout', endpoint="logout",
|
||||||
@ -115,13 +116,14 @@ class OAuth2Authentication(BaseAuthentication):
|
|||||||
|
|
||||||
def login(self, form):
|
def login(self, form):
|
||||||
profile = self.get_user_profile()
|
profile = self.get_user_profile()
|
||||||
print(profile)
|
|
||||||
if 'email' not in profile or not profile['email']:
|
if 'email' not in profile or not profile['email']:
|
||||||
current_app.logger.exception(
|
current_app.logger.exception(
|
||||||
'An email is required for authentication'
|
"An email id is required to login into pgAdmin. "
|
||||||
|
"Please update your Oauth2 profile."
|
||||||
)
|
)
|
||||||
return False, gettext(
|
return False, gettext(
|
||||||
"An email is required for the oauth authentication.")
|
"An email id is required to login into pgAdmin. "
|
||||||
|
"Please update your Oauth2 profile.")
|
||||||
|
|
||||||
user, msg = self.__auto_create_user(profile)
|
user, msg = self.__auto_create_user(profile)
|
||||||
if user:
|
if user:
|
||||||
|
Loading…
Reference in New Issue
Block a user