Merge pull request #33485 from nextcloud/bugfix/noid/authtoken-duplicate-update

Do not update passwords if nothing changed
This commit is contained in:
Julius Härtl 2022-08-09 20:38:55 +02:00 committed by GitHub
commit 7992a3ef50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -409,9 +409,12 @@ class PublicKeyTokenProvider implements IProvider {
$tokens = $this->mapper->getTokenByUser($uid); $tokens = $this->mapper->getTokenByUser($uid);
foreach ($tokens as $t) { foreach ($tokens as $t) {
$publicKey = $t->getPublicKey(); $publicKey = $t->getPublicKey();
$t->setPassword($this->encryptPassword($password, $publicKey)); $encryptedPassword = $this->encryptPassword($password, $publicKey);
$t->setPasswordInvalid(false); if ($t->getPassword() !== $encryptedPassword) {
$this->updateToken($t); $t->setPassword($encryptedPassword);
$t->setPasswordInvalid(false);
$this->updateToken($t);
}
} }
} }