aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/User
diff options
context:
space:
mode:
authorAndrew Summers <18727110+summersab@users.noreply.github.com>2023-08-29 18:11:00 -0500
committerJohn Molakvoæ <skjnldsv@users.noreply.github.com>2024-03-15 13:04:27 +0100
commitf9ce6bfdff10665d40400c80662e9b29a00d8b3f (patch)
tree673764e3d5edb4d803db744a3d4241e9437e74f4 /lib/private/User
parentdf1cd1ba7e6e1f6e66a2b3229b5c082f1b81162e (diff)
downloadnextcloud-server-f9ce6bfdff10665d40400c80662e9b29a00d8b3f.tar.gz
nextcloud-server-f9ce6bfdff10665d40400c80662e9b29a00d8b3f.zip
Refactor `OC\Server::getHasher`
Signed-off-by: Andrew Summers <18727110+summersab@users.noreply.github.com>
Diffstat (limited to 'lib/private/User')
-rw-r--r--lib/private/User/Database.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/private/User/Database.php b/lib/private/User/Database.php
index 9ef1bc67a58..55d0183ce52 100644
--- a/lib/private/User/Database.php
+++ b/lib/private/User/Database.php
@@ -50,6 +50,7 @@ use OCP\Cache\CappedMemoryCache;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IDBConnection;
use OCP\Security\Events\ValidatePasswordPolicyEvent;
+use OCP\Security\IHasher;
use OCP\User\Backend\ABackend;
use OCP\User\Backend\ICheckPasswordBackend;
use OCP\User\Backend\ICountUsersBackend;
@@ -130,7 +131,7 @@ class Database extends ABackend implements
$qb->insert($this->table)
->values([
'uid' => $qb->createNamedParameter($uid),
- 'password' => $qb->createNamedParameter(\OC::$server->getHasher()->hash($password)),
+ 'password' => $qb->createNamedParameter(\OC::$server->get(IHasher::class)->hash($password)),
'uid_lower' => $qb->createNamedParameter(mb_strtolower($uid)),
]);
@@ -197,7 +198,7 @@ class Database extends ABackend implements
if ($this->userExists($uid)) {
$this->eventDispatcher->dispatchTyped(new ValidatePasswordPolicyEvent($password));
- $hasher = \OC::$server->getHasher();
+ $hasher = \OC::$server->get(IHasher::class);
$hashedPassword = $hasher->hash($password);
$return = $this->updatePassword($uid, $hashedPassword);
@@ -353,7 +354,7 @@ class Database extends ABackend implements
if ($found && is_array($this->cache[$loginName])) {
$storedHash = $this->cache[$loginName]['password'];
$newHash = '';
- if (\OC::$server->getHasher()->verify($password, $storedHash, $newHash)) {
+ if (\OC::$server->get(IHasher::class)->verify($password, $storedHash, $newHash)) {
if (!empty($newHash)) {
$this->updatePassword($loginName, $newHash);
}