1
0
Fork 0
mirror of synced 2024-10-01 17:58:02 +13:00

Try to fix targets bug

This commit is contained in:
Matej Bačo 2024-01-20 13:07:53 +00:00
parent 42eb051368
commit eb597b2bd2
3 changed files with 23 additions and 0 deletions

View file

@ -1199,6 +1199,16 @@ App::patch('/v1/users/:userId/email')
} else {
$dbForProject->deleteDocument('targets', $oldTarget->getId());
}
} else {
if (\strlen($email) !== 0) {
$target = $dbForProject->createDocument('targets', new Document([
'userId' => $user->getId(),
'userInternalId' => $user->getInternalId(),
'providerType' => 'email',
'identifier' => $email,
]));
$user->setAttribute('targets', [...$user->getAttribute('targets', []), $target]);
}
}
$dbForProject->deleteCachedDocument('users', $user->getId());
} catch (Duplicate $th) {
@ -1268,6 +1278,16 @@ App::patch('/v1/users/:userId/phone')
} else {
$dbForProject->deleteDocument('targets', $oldTarget->getId());
}
} else {
if (\strlen($number) !== 0) {
$target = $dbForProject->createDocument('targets', new Document([
'userId' => $user->getId(),
'userInternalId' => $user->getInternalId(),
'providerType' => 'sms',
'identifier' => $number,
]));
$user->setAttribute('targets', [...$user->getAttribute('targets', []), $target]);
}
}
$dbForProject->deleteCachedDocument('users', $user->getId());
} catch (Duplicate $th) {

View file

@ -17,6 +17,8 @@ class PasswordHistory extends Password
public function __construct(array $history, string $algo, array $algoOptions = [])
{
parent::__construct();
$this->history = $history;
$this->algo = $algo;
$this->algoOptions = $algoOptions;

View file

@ -14,6 +14,7 @@ class PersonalData extends Password
protected ?string $phone = null,
protected bool $strict = false
) {
parent::__construct();
}
/**