Skip to content

Commit

Permalink
Fix the issue where the update-user CLI command doesn't change the pa…
Browse files Browse the repository at this point in the history
…ssword. pgadmin-org#7304
  • Loading branch information
benjaminjb authored Mar 27, 2024
1 parent b742487 commit 48a86f6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions web/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
from typing_extensions import Annotated
from pgadmin.utils.constants import INTERNAL, LDAP, OAUTH2, \
KERBEROS, WEBSERVER
from pgadmin.tools.user_management import create_user, delete_user, update_user
from pgadmin.tools.user_management import create_user, delete_user, \
update_user as user_management_update_user
from enum import Enum
from flask_babel import gettext

Expand Down Expand Up @@ -244,7 +245,10 @@ def update_user(email: str,
if len(password) < 6:
print("Password must be at least 6 characters long.")
exit()
data['password'] = password
# validate_password relies on the new password being present as
# `newPassword` and `confirmPassword` in the data
data['newPassword'] = password
data['confirmPassword'] = password

if role is not None:
data['role'] = 1 if role else 2
Expand All @@ -258,7 +262,7 @@ def update_user(email: str,
if not uid:
print("User not found")
else:
status, msg = update_user(uid, data)
status, msg = user_management_update_user(uid, data)
if status:
_user = ManageUsers.get_users_from_db(username=email,
auth_source=INTERNAL,
Expand Down Expand Up @@ -344,7 +348,7 @@ def update_external_user(username: str,
if not uid:
print("User not found")
else:
status, msg = update_user(uid, data)
status, msg = user_management_update_user(uid, data)
if status:
_user = ManageUsers.get_users_from_db(
username=username,
Expand Down

0 comments on commit 48a86f6

Please sign in to comment.