diff --git a/application/Espo/Controllers/User.php b/application/Espo/Controllers/User.php index 6963f1786e..6a09e09bf4 100644 --- a/application/Espo/Controllers/User.php +++ b/application/Espo/Controllers/User.php @@ -63,8 +63,10 @@ class User extends \Espo\Core\Controllers\Record throw new BadRequest(); } - return $this->getService('User') + $this->getService('User') ->changePassword($this->getUser()->id, $data->password, true, $data->currentPassword); + + return true; } public function postActionChangePasswordByRequest($params, $data, $request) diff --git a/application/Espo/Services/User.php b/application/Espo/Services/User.php index 2562fa3f1a..1e80188ba8 100644 --- a/application/Espo/Services/User.php +++ b/application/Espo/Services/User.php @@ -89,8 +89,12 @@ class User extends Record implements } public function changePassword( - string $userId, string $password, bool $checkCurrentPassword = false, ?string $currentPassword = null - ) { + string $userId, + string $password, + bool $checkCurrentPassword = false, + ?string $currentPassword = null + ): void { + $user = $this->getEntityManager()->getEntity('User', $userId); if (!$user) { @@ -132,8 +136,6 @@ class User extends Record implements $user->set('password', $this->hashPassword($password)); $this->getEntityManager()->saveEntity($user); - - return true; } public function checkPasswordStrength(string $password): bool