]> source.dussan.org Git - nextcloud-server.git/commitdiff
Do not update passwords if nothing changed 33489/head
authorJulius Härtl <jus@bitgrid.net>
Mon, 8 Aug 2022 15:41:52 +0000 (17:41 +0200)
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>
Tue, 9 Aug 2022 18:54:21 +0000 (18:54 +0000)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
lib/private/Authentication/Token/PublicKeyTokenProvider.php

index a6c672f70c6c5f6cc1fa1d856ea6b5e56259f2ab..2fc52ecf54496ce9d205e2162a926879f83a5a8c 100644 (file)
@@ -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);
+                       }
                }
        }