Fix verification of passwords
parent
f76ebfac79
commit
52d31cbd7c
|
@ -32,7 +32,7 @@ function hasDomainAccess($username, $role, $domain) {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
function verify_ssha256($password, $hash) {
|
function verify_ssha256($hash, $password) {
|
||||||
// Remove tag if any
|
// Remove tag if any
|
||||||
$hash = ltrim($hash, '{SSHA256}');
|
$hash = ltrim($hash, '{SSHA256}');
|
||||||
// Decode hash
|
// Decode hash
|
||||||
|
@ -100,7 +100,7 @@ function check_login($user, $pass) {
|
||||||
$stmt->execute(array(':user' => $user));
|
$stmt->execute(array(':user' => $user));
|
||||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
if (doveadm_authenticate($row['password'], $pass) !== false) {
|
if (verify_ssha256($row['password'], $pass) !== false) {
|
||||||
unset($_SESSION['ldelay']);
|
unset($_SESSION['ldelay']);
|
||||||
return "domainadmin";
|
return "domainadmin";
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ function check_login($user, $pass) {
|
||||||
$stmt->execute(array(':user' => $user));
|
$stmt->execute(array(':user' => $user));
|
||||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
if (doveadm_authenticate($row['password'], $pass) !== false) {
|
if (verify_ssha256($row['password'], $pass) !== false) {
|
||||||
unset($_SESSION['ldelay']);
|
unset($_SESSION['ldelay']);
|
||||||
return "user";
|
return "user";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue