aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2022-08-09 20:38:55 +0200
committerGitHub <noreply@github.com>2022-08-09 20:38:55 +0200
commit7992a3ef506a5ba9e71a61994091b2f4281f5c09 (patch)
treead2a9ed158a2322111f79e6127b6bae9256e45cc
parent1405b7a8ca43b5565a8c0427854bd01efd426402 (diff)
parent9d1ec582ba365573f1fc254bd63ae6446913a1f2 (diff)
downloadnextcloud-server-7992a3ef506a5ba9e71a61994091b2f4281f5c09.tar.gz
nextcloud-server-7992a3ef506a5ba9e71a61994091b2f4281f5c09.zip
Merge pull request #33485 from nextcloud/bugfix/noid/authtoken-duplicate-update
Do not update passwords if nothing changed
-rw-r--r--lib/private/Authentication/Token/PublicKeyTokenProvider.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/private/Authentication/Token/PublicKeyTokenProvider.php b/lib/private/Authentication/Token/PublicKeyTokenProvider.php
index f9ebe90c890..0f1767e845b 100644
--- a/lib/private/Authentication/Token/PublicKeyTokenProvider.php
+++ b/lib/private/Authentication/Token/PublicKeyTokenProvider.php
@@ -409,9 +409,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);
+ }
}
}