mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-09 23:15:58 -06:00
Ensure that internal users are able to login when auth sources are [ldap, internal]. #6151
This commit is contained in:
parent
62baa0dccb
commit
39a0f46159
@ -289,6 +289,10 @@ class AuthSourceManager:
|
||||
if msg is not None and 'username' in msg:
|
||||
self.form._fields['email'].data = msg['username']
|
||||
return status, msg
|
||||
else:
|
||||
current_app.logger.debug(
|
||||
"Authentication initiated via source: %s is failed." %
|
||||
source.get_source_name())
|
||||
|
||||
return status, msg
|
||||
|
||||
|
@ -106,8 +106,9 @@ class InternalAuthentication(BaseAuthentication):
|
||||
|
||||
def authenticate(self, form):
|
||||
username = form.data['email']
|
||||
user = getattr(form, 'user',
|
||||
User.query.filter_by(username=username).first())
|
||||
if user and user.is_authenticated and form.validate_on_submit():
|
||||
return True, None
|
||||
if form.validate_on_submit():
|
||||
user = getattr(form, 'user',
|
||||
User.query.filter_by(username=username).first())
|
||||
if user and user.is_authenticated:
|
||||
return True, None
|
||||
return False, self.messages('USER_DOES_NOT_EXIST')
|
||||
|
Loading…
Reference in New Issue
Block a user