Fixed an issue where a warning is flashed every time for an email address when

authentication sources are internal and ldap. Fixes #6999
This commit is contained in:
Yogesh Mahajan 2022-02-16 13:34:24 +05:30 committed by Akshay Joshi
parent b1221d5517
commit b539637426
6 changed files with 15 additions and 10 deletions

View File

@ -20,6 +20,7 @@ Housekeeping
Bug fixes
*********
| `Issue #6999 <https://redmine.postgresql.org/issues/6999>`_ - Fixed an issue where a warning is flashed every time for an email address when authentication sources are internal and ldap.
| `Issue #7124 <https://redmine.postgresql.org/issues/7124>`_ - Fixed the schema diff issue where tables have different column positions and a column has a default value.
| `Issue #7152 <https://redmine.postgresql.org/issues/7152>`_ - Added comments column for the functions collection node.
| `Issue #7173 <https://redmine.postgresql.org/issues/7173>`_ - Fixed an issue where the User Management dialog is not opening.

View File

@ -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):

View File

@ -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']

View File

@ -163,7 +163,7 @@ class KerberosAuthentication(BaseAuthentication):
return gettext("kerberos")
def validate(self, form):
return True
return True, None
def authenticate(self, frm):

View File

@ -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()

View File

@ -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)