Refactor user password update logic: Only update password and token if a new password is provided. Update frontend to conditionally include password in the request data, improving user experience and data handling.

Fix: https://github.com/usmannasir/cyberpanel/issues/1509
This commit is contained in:
Master3395
2025-09-21 01:07:54 +02:00
parent 13677f0d6d
commit 8dc6181de3
2 changed files with 11 additions and 5 deletions

View File

@@ -305,11 +305,15 @@ app.controller('modifyUser', function ($scope, $http) {
firstName: firstName,
lastName: lastName,
email: email,
passwordByPass: password,
securityLevel: $scope.securityLevel,
twofa: $scope.twofa
};
// Only include password if it's provided and not empty
if (password && password.trim()) {
data.passwordByPass = password;
}
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')