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 5, 2024
1 parent 207c72c commit a0662ad
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 @@ -199,6 +200,9 @@ public function getPasswordHash(string $userId): ?string {
}

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

0 comments on commit a0662ad

Please sign in to comment.