diff --git a/docs/en_US/release_notes_6_6.rst b/docs/en_US/release_notes_6_6.rst index 433cbe1a0..8c84d16a2 100644 --- a/docs/en_US/release_notes_6_6.rst +++ b/docs/en_US/release_notes_6_6.rst @@ -20,6 +20,7 @@ Housekeeping Bug fixes ********* +| `Issue #6999 `_ - Fixed an issue where a warning is flashed every time for an email address when authentication sources are internal and ldap. | `Issue #7124 `_ - Fixed the schema diff issue where tables have different column positions and a column has a default value. | `Issue #7152 `_ - Added comments column for the functions collection node. | `Issue #7173 `_ - Fixed an issue where the User Management dialog is not opening. diff --git a/web/pgadmin/authenticate/__init__.py b/web/pgadmin/authenticate/__init__.py index 8b83f5898..c62fbe22b 100644 --- a/web/pgadmin/authenticate/__init__.py +++ b/web/pgadmin/authenticate/__init__.py @@ -211,10 +211,14 @@ class AuthSourceManager: def validate(self): """Validate through all the sources.""" + err_msg = None for src in self.auth_sources: source = get_auth_sources(src) - if source.validate(self.form): + status, err_msg = source.validate(self.form) + if status: return True + if err_msg: + flash(err_msg, 'warning') return False def authenticate(self): diff --git a/web/pgadmin/authenticate/internal.py b/web/pgadmin/authenticate/internal.py index 8e16c5ee3..64517cc10 100644 --- a/web/pgadmin/authenticate/internal.py +++ b/web/pgadmin/authenticate/internal.py @@ -54,14 +54,14 @@ class BaseAuthentication(object): form.email.errors = list(form.email.errors) form.email.errors.append(gettext( self.messages('EMAIL_NOT_PROVIDED'))) - return False + return False, None if password is None or password == '': form.password.errors = list(form.password.errors) form.password.errors.append( self.messages('PASSWORD_NOT_PROVIDED')) - return False + return False, None - return True + return True, None def login(self, form): username = form.data['email'] @@ -99,10 +99,10 @@ class InternalAuthentication(BaseAuthentication): """User validation""" # validate the email id first if not validate_email(form.data['email']): - flash(self.messages('INVALID_EMAIL'), 'warning') - return False + return False, self.messages('INVALID_EMAIL') # Flask security validation - return form.validate_on_submit() + submit = form.validate_on_submit() + return submit, None def authenticate(self, form): username = form.data['email'] diff --git a/web/pgadmin/authenticate/kerberos.py b/web/pgadmin/authenticate/kerberos.py index 94cb855c3..81205d654 100644 --- a/web/pgadmin/authenticate/kerberos.py +++ b/web/pgadmin/authenticate/kerberos.py @@ -163,7 +163,7 @@ class KerberosAuthentication(BaseAuthentication): return gettext("kerberos") def validate(self, form): - return True + return True, None def authenticate(self, frm): diff --git a/web/pgadmin/authenticate/oauth2.py b/web/pgadmin/authenticate/oauth2.py index 08bdfead4..935d110a7 100644 --- a/web/pgadmin/authenticate/oauth2.py +++ b/web/pgadmin/authenticate/oauth2.py @@ -115,7 +115,7 @@ class OAuth2Authentication(BaseAuthentication): return self.oauth2_config[self.oauth2_current_client]['OAUTH2_NAME'] def validate(self, form): - return True + return True, None def login(self, form): profile = self.get_user_profile() diff --git a/web/pgadmin/authenticate/webserver.py b/web/pgadmin/authenticate/webserver.py index 8178dfbc9..3d4e28e35 100644 --- a/web/pgadmin/authenticate/webserver.py +++ b/web/pgadmin/authenticate/webserver.py @@ -74,7 +74,7 @@ class WebserverAuthentication(BaseAuthentication): return gettext("webserver") def validate(self, form): - return True + return True, None def get_user(self): username = request.environ.get(config.WEBSERVER_REMOTE_USER)