Delete matches when a user changes their phone number

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2021-03-09 20:32:50 +01:00
parent 3feca65399
commit 19ccc992d5
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
1 changed files with 4 additions and 0 deletions

View File

@ -686,6 +686,10 @@ class UsersController extends AUserData {
$userAccount[$key]['value'] = $value; $userAccount[$key]['value'] = $value;
try { try {
$this->accountManager->updateUser($targetUser, $userAccount, true); $this->accountManager->updateUser($targetUser, $userAccount, true);
if ($key === IAccountManager::PROPERTY_PHONE) {
$this->knownUserMapper->deleteKnownUser($targetUser->getUID());
}
} catch (\InvalidArgumentException $e) { } catch (\InvalidArgumentException $e) {
throw new OCSException('Invalid ' . $e->getMessage(), 102); throw new OCSException('Invalid ' . $e->getMessage(), 102);
} }