mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
fix(authentication): Only verify each hash once
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
3892c3edc9
commit
55d8aec759
1 changed files with 4 additions and 2 deletions
|
|
@ -448,9 +448,11 @@ class PublicKeyTokenProvider implements IProvider {
|
|||
// Update the password for all tokens
|
||||
$tokens = $this->mapper->getTokenByUser($uid);
|
||||
$passwordHash = $this->hashPassword($password);
|
||||
$verifiedHashes = [];
|
||||
foreach ($tokens as $t) {
|
||||
$publicKey = $t->getPublicKey();
|
||||
if ($t->getPasswordHash() === null || $this->hasher->verify(sha1($password) . $password, $t->getPasswordHash())) {
|
||||
if ($t->getPasswordHash() === null || isset($verifiedHashes[$t->getPasswordHash()]) || $this->hasher->verify(sha1($password) . $password, $t->getPasswordHash())) {
|
||||
$verifiedHashes[$t->getPasswordHash() ?: ''] = true;
|
||||
$publicKey = $t->getPublicKey();
|
||||
$t->setPassword($this->encryptPassword($password, $publicKey));
|
||||
$t->setPasswordHash($passwordHash);
|
||||
$t->setPasswordInvalid(false);
|
||||
|
|
|
|||
Loading…
Reference in a new issue