diff options
author | Marcin Łojewski <marcin.lojewski@mlojewski.me> | 2018-06-30 14:19:04 +0300 |
---|---|---|
committer | Marcin Łojewski <marcin.lojewski@mlojewski.me> | 2018-06-30 14:19:04 +0300 |
commit | a2b65f144c51be46335d34d12f3310e3533e4329 (patch) | |
tree | c316360929c6f6496f0bb6b8b20411d6acb5a83a /lib/Backend | |
parent | 434e2777c39ee0c0ff12f3c1e8c172fc47b7207b (diff) |
Adding SALT from DB and new Algorithm to be connected with HumHub
https://github.com/nextcloud/user_sql/pull/42
Diffstat (limited to 'lib/Backend')
-rw-r--r-- | lib/Backend/UserBackend.php | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/Backend/UserBackend.php b/lib/Backend/UserBackend.php index 88119ee..6a8237b 100644 --- a/lib/Backend/UserBackend.php +++ b/lib/Backend/UserBackend.php @@ -274,6 +274,10 @@ final class UserBackend extends Backend return false; } + if ($user->salt !== null) { + $password .= $user->salt; + } + $isCorrect = $passwordAlgorithm->checkPassword( $password, $user->password ); @@ -417,13 +421,17 @@ final class UserBackend extends Backend return false; } - $passwordHash = $passwordAlgorithm->getPasswordHash($password); - if ($passwordHash === false) { + $user = $this->userRepository->findByUid($uid); + if (!($user instanceof User)) { return false; } - $user = $this->userRepository->findByUid($uid); - if (!($user instanceof User)) { + if ($user->salt !== null) { + $password .= $user->salt; + } + + $passwordHash = $passwordAlgorithm->getPasswordHash($password); + if ($passwordHash === false) { return false; } |