Skip to content

Commit

Permalink
feat: Validate password 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 Jul 8, 2024
1 parent dba0056 commit c390ae9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/private/User/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/
namespace OC\User;

use InvalidArgumentException;
use OCP\AppFramework\Db\TTransactional;
use OCP\Cache\CappedMemoryCache;
use OCP\EventDispatcher\IEventDispatcher;
Expand Down Expand Up @@ -200,6 +201,9 @@ public function getPasswordHash(string $userId): ?string {
}

public function setPasswordHash(string $userId, string $passwordHash): bool {
if (!\OCP\Server::get(IHasher::class)->validate($passwordHash)) {
throw new InvalidArgumentException();
}
$this->fixDI();
$result = $this->updatePassword($userId, $passwordHash);
if (!$result) {
Expand Down

0 comments on commit c390ae9

Please sign in to comment.