From 28dcfd714e0ab0be3aa9dde217a31e84c50bc657 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Wed, 28 Apr 2021 10:33:27 +0300 Subject: [PATCH] cs fix --- application/Espo/Controllers/User.php | 4 +++- application/Espo/Services/User.php | 10 ++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) 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