Adding SALT from DB and new Algorithm to be connected with HumHub

https://github.com/nextcloud/user_sql/pull/42
This commit is contained in:
Marcin Łojewski
2018-06-30 13:19:04 +02:00
parent 434e2777c3
commit a2b65f144c
10 changed files with 142 additions and 8 deletions

View File

@@ -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;
}