diff options
author | Joas Schilling <coding@schilljs.com> | 2023-02-10 09:18:50 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-02-10 09:18:50 +0100 |
commit | 6417ea02655e6e16067ee1633aa3bb5ec09c5a2e (patch) | |
tree | 809a874bc39a89a879cee2d9d0ea2e4836920a5a /lib/private/Authentication | |
parent | d9cd8b1d37375ad567b4d15828e4d84b9cf58526 (diff) | |
download | nextcloud-server-6417ea02655e6e16067ee1633aa3bb5ec09c5a2e.tar.gz nextcloud-server-6417ea02655e6e16067ee1633aa3bb5ec09c5a2e.zip |
fix(authentication): Handle null or empty string password hash
This can happen when the auth.storeCryptedPassword config is used,
which previously errored with:
Hasher::verify(): Argument #2 ($hash) must be of type string, null given
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Authentication')
-rw-r--r-- | lib/private/Authentication/Token/PublicKeyTokenProvider.php | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/private/Authentication/Token/PublicKeyTokenProvider.php b/lib/private/Authentication/Token/PublicKeyTokenProvider.php index 84708065070..38bbef8fb61 100644 --- a/lib/private/Authentication/Token/PublicKeyTokenProvider.php +++ b/lib/private/Authentication/Token/PublicKeyTokenProvider.php @@ -113,7 +113,7 @@ class PublicKeyTokenProvider implements IProvider { // We need to check against one old token to see if there is a password // hash that we can reuse for detecting outdated passwords $randomOldToken = $this->mapper->getFirstTokenForUser($uid); - $oldTokenMatches = $randomOldToken && $this->hasher->verify(sha1($password) . $password, $randomOldToken->getPasswordHash()); + $oldTokenMatches = $randomOldToken && $randomOldToken->getPasswordHash() && $this->hasher->verify(sha1($password) . $password, $randomOldToken->getPasswordHash()); $dbToken = $this->newToken($token, $uid, $loginName, $password, $name, $type, $remember); |