Update the Update Phone API to also set the password
This is to ensure the behavior matches the Update Email endpoint.
This commit is contained in:
parent
5ef3162cee
commit
5afc49784e
1 changed files with 8 additions and 0 deletions
|
@ -1706,6 +1706,14 @@ App::patch('/v1/account/phone')
|
||||||
->setAttribute('phoneVerification', false) // After this user needs to confirm phone number again
|
->setAttribute('phoneVerification', false) // After this user needs to confirm phone number again
|
||||||
->setAttribute('search', implode(' ', [$user->getId(), $user->getAttribute('name', ''), $user->getAttribute('email', ''), $phone]));
|
->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 {
|
try {
|
||||||
$user = $dbForProject->withRequestTimestamp($requestTimestamp, fn () => $dbForProject->updateDocument('users', $user->getId(), $user));
|
$user = $dbForProject->withRequestTimestamp($requestTimestamp, fn () => $dbForProject->updateDocument('users', $user->getId(), $user));
|
||||||
} catch (Duplicate $th) {
|
} catch (Duplicate $th) {
|
||||||
|
|
Loading…
Reference in a new issue