summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-10-03 12:08:49 +0200
committerGitHub <noreply@github.com>2018-10-03 12:08:49 +0200
commit213d43f0438ba82dd93885fb22b7d0768ed6fe79 (patch)
treec40f9a5c5293b475598176a90e337e9d669c42a7
parentae71a5574fca237ca6b1b242350e292ebf01b8ea (diff)
parent0c9a3de68f746f0f39513a579d69799a2aec5ad0 (diff)
downloadnextcloud-server-213d43f0438ba82dd93885fb22b7d0768ed6fe79.tar.gz
nextcloud-server-213d43f0438ba82dd93885fb22b7d0768ed6fe79.zip
Merge pull request #11568 from nextcloud/fix/11097/just_update_password_hash
Just update password hash without validating
-rw-r--r--lib/private/User/Database.php20
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/private/User/Database.php b/lib/private/User/Database.php
index 532b2f8c03c..905a199a1a6 100644
--- a/lib/private/User/Database.php
+++ b/lib/private/User/Database.php
@@ -176,6 +176,16 @@ class Database extends ABackend
return $result ? true : false;
}
+ private function updatePassword(string $uid, string $passwordHash): bool {
+ $query = $this->dbConn->getQueryBuilder();
+ $query->update($this->table)
+ ->set('password', $query->createNamedParameter($passwordHash))
+ ->where($query->expr()->eq('uid_lower', $query->createNamedParameter(mb_strtolower($uid))));
+ $result = $query->execute();
+
+ return $result ? true : false;
+ }
+
/**
* Set password
*
@@ -195,13 +205,7 @@ class Database extends ABackend
$hasher = \OC::$server->getHasher();
$hashedPassword = $hasher->hash($password);
- $query = $this->dbConn->getQueryBuilder();
- $query->update($this->table)
- ->set('password', $query->createNamedParameter($hashedPassword))
- ->where($query->expr()->eq('uid_lower', $query->createNamedParameter(mb_strtolower($uid))));
- $result = $query->execute();
-
- return $result ? true : false;
+ return $this->updatePassword($uid, $hashedPassword);
}
return false;
@@ -314,7 +318,7 @@ class Database extends ABackend
$newHash = '';
if (\OC::$server->getHasher()->verify($password, $storedHash, $newHash)) {
if (!empty($newHash)) {
- $this->setPassword($uid, $password);
+ $this->updatePassword($uid, $newHash);
}
return (string)$row['uid'];
}