Skip to content

Commit

Permalink
feat: Validate hash
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Ng <chrng8@gmail.com>
  • Loading branch information
Pytal committed Jun 28, 2024
1 parent 7f329da commit 99d49d4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/UserBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

namespace OCA\Guests;

use InvalidArgumentException;
use OC\Cache\CappedMemoryCache;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IDBConnection;
Expand Down Expand Up @@ -179,6 +180,9 @@ public function getPasswordHash(string $userId): ?string {
}

public function setPasswordHash(string $userId, string $passwordHash): bool {
if (!$this->hasher->validate($passwordHash)) {
throw new InvalidArgumentException();
}
$qb = $this->dbConn->getQueryBuilder();
$qb->update('guests_users')
->set('password', $qb->createNamedParameter($passwordHash))
Expand Down

0 comments on commit 99d49d4

Please sign in to comment.