Hash the password for an unknown username at login.
An unknown username got a fast answer, which showed which usernames exist.
This commit is contained in:
+3
-4
@@ -29,14 +29,13 @@ if (isset($_SESSION['editor'])) {
|
||||
$getid = $db->execute_query($query, array($username)) or db_fail();
|
||||
$row = $getid->fetch_assoc();
|
||||
|
||||
$stored_password = '';
|
||||
$stored_password = NULL;
|
||||
if (isset($row))
|
||||
$stored_password = $row['password'];
|
||||
$stored_password = (string)$row['password'];
|
||||
else $denied = TRUE;
|
||||
$getid->close();
|
||||
$compare_password = is_string($_POST['password'] ?? NULL) ? $_POST['password'] : '';
|
||||
// password_verify() also accepts hashes made by the old crypt() call
|
||||
if (!password_verify($compare_password, $stored_password)) {
|
||||
if (!editor_password_valid($compare_password, $stored_password)) {
|
||||
$denied = TRUE;
|
||||
record_login_failure($username);
|
||||
open_db('close');
|
||||
|
||||
Reference in New Issue
Block a user