diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index e2282fd98..85d59bd02 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -1706,6 +1706,14 @@ App::patch('/v1/account/phone') ->setAttribute('phoneVerification', false) // After this user needs to confirm phone number again ->setAttribute('search', implode(' ', [$user->getId(), $user->getAttribute('name', ''), $user->getAttribute('email', ''), $phone])); + if (empty($passwordUpdate)) { + $user + ->setAttribute('password', Auth::passwordHash($password, Auth::DEFAULT_ALGO, Auth::DEFAULT_ALGO_OPTIONS)) + ->setAttribute('hash', Auth::DEFAULT_ALGO) + ->setAttribute('hashOptions', Auth::DEFAULT_ALGO_OPTIONS) + ->setAttribute('passwordUpdate', DateTime::now()); + } + try { $user = $dbForProject->withRequestTimestamp($requestTimestamp, fn () => $dbForProject->updateDocument('users', $user->getId(), $user)); } catch (Duplicate $th) {