Skip to content

Commit

Permalink
bugfix 2
Browse files Browse the repository at this point in the history
  • Loading branch information
konradziczek authored Oct 5, 2023
1 parent 4038aa9 commit 3933ffb
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions web/pgadmin/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,26 +801,25 @@ def clear_database_servers(load_user=current_user, from_setup=False):


def _does_user_exist(user, from_setup):
"""
This function will check user is exist or not. If exist then return
"""
if isinstance(user, User):
if user.email:
user = user.email
new_user = User.query.filter_by(email=user).first()
elif user.username:
user = user.username
new_user = User.query.filter_by(username=user).first()
else:
new_user = None
else:
new_user = User.query.filter_by(email=user).first()

if new_user is None:
print(USER_NOT_FOUND % user)
if from_setup:
sys.exit(1)

"""
This function will check user is exist or not. If exist then return
"""
if isinstance(user, User):
if user.username:
auth_source = user.auth_source
user = user.username
new_user = User.query.filter_by(username=user, auth_source=auth_source).first()
else:
user = ""
new_user = None
else:
new_user = User.query.filter_by(email=user).first()

if new_user is None:
print(USER_NOT_FOUND % user)
if from_setup:
sys.exit(1)

return new_user


Expand Down

0 comments on commit 3933ffb

Please sign in to comment.