This commit is contained in:
Bruno Rybársky 2024-02-03 17:16:23 +01:00
parent 6753603ecd
commit e3bc9f4989

@ -106,6 +106,7 @@ function doLogin($email, $password): array
$loginCount = 0; $loginCount = 0;
$stmt->bind_result($uid, $first_name, $last_name, $nickname, $password_hash, $minecraft_nickname, $privilege_level, $lastLoginAt, $loginCount); $stmt->bind_result($uid, $first_name, $last_name, $nickname, $password_hash, $minecraft_nickname, $privilege_level, $lastLoginAt, $loginCount);
$stmt->fetch(); $stmt->fetch();
$stmt->close();
echo "user found"; echo "user found";
if (password_verify($password, $password_hash)) { if (password_verify($password, $password_hash)) {
@ -125,7 +126,6 @@ function doLogin($email, $password): array
$_SESSION["email"] = $email; $_SESSION["email"] = $email;
$_SESSION["minecraft_nickname"] = $minecraft_nickname; $_SESSION["minecraft_nickname"] = $minecraft_nickname;
$_SESSION["privilege_level"] = $privilege_level; $_SESSION["privilege_level"] = $privilege_level;
$stmt->close();
} }
return $found ? ["Status" => "Success"] : ["Status" => "Fail"]; return $found ? ["Status" => "Success"] : ["Status" => "Fail"];
} }