Fix the issue where the update-user CLI command doesn't change the password. #7304

This commit is contained in:
Benjamin Blattberg 2024-03-27 01:17:58 -05:00 committed by GitHub
parent b742487dc3
commit 48a86f6c38
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -47,7 +47,8 @@ from typing import Optional, List
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
@ -244,7 +245,10 @@ class ManageUsers:
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
@ -258,7 +262,7 @@ class ManageUsers:
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,
@ -344,7 +348,7 @@ class ManageUsers:
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,