From f5d91e9b2837c51fed385e72be4f14738cac6bac Mon Sep 17 00:00:00 2001 From: =?utf8?q?Julius=20H=C3=A4rtl?= Date: Mon, 8 Aug 2022 17:41:52 +0200 Subject: [PATCH] Do not update passwords if nothing changed MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- .../Authentication/Token/PublicKeyTokenProvider.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/private/Authentication/Token/PublicKeyTokenProvider.php b/lib/private/Authentication/Token/PublicKeyTokenProvider.php index a6c672f70c6..2fc52ecf544 100644 --- a/lib/private/Authentication/Token/PublicKeyTokenProvider.php +++ b/lib/private/Authentication/Token/PublicKeyTokenProvider.php @@ -433,9 +433,12 @@ class PublicKeyTokenProvider implements IProvider { $tokens = $this->mapper->getTokenByUser($uid); foreach ($tokens as $t) { $publicKey = $t->getPublicKey(); - $t->setPassword($this->encryptPassword($password, $publicKey)); - $t->setPasswordInvalid(false); - $this->updateToken($t); + $encryptedPassword = $this->encryptPassword($password, $publicKey); + if ($t->getPassword() !== $encryptedPassword) { + $t->setPassword($encryptedPassword); + $t->setPasswordInvalid(false); + $this->updateToken($t); + } } } -- 2.39.5