only update hash if password matches, fixes #1479

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2015-01-31 12:51:20 +01:00
parent 7680cd441c
commit 4d60b19194

View File

@@ -60,19 +60,20 @@ function validatePasswordLogin($userinfo = null, $password = null, $table = 'pan
}
}
// check for update of hash
if ($update_hash) {
$upd_stmt = Database::prepare("
UPDATE " . $table . " SET `password` = :newpasswd WHERE `" . $uid . "` = :uid
");
$params = array (
if ($pwd_hash == $pwd_check) {
// check for update of hash
if ($update_hash) {
$upd_stmt = Database::prepare("
UPDATE " . $table . " SET `password` = :newpasswd WHERE `" . $uid . "` = :uid
");
$params = array (
'newpasswd' => makeCryptPassword($password),
'uid' => $userinfo[$uid]
);
Database::pexecute($upd_stmt, $params);
}
);
Database::pexecute($upd_stmt, $params);
}
if ($pwd_hash == $pwd_check) {
return true;
}
return false;