From 20a26ebd6697d62c5754923c62c6d35610d8add3 Mon Sep 17 00:00:00 2001 From: Johannes Kantz <67144859+JohannesKantz@users.noreply.github.com> Date: Wed, 25 Jan 2023 08:16:44 +0100 Subject: [PATCH] fix login error --- User.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/User.php b/User.php index ba73a67..ca43bd2 100644 --- a/User.php +++ b/User.php @@ -18,11 +18,13 @@ class User { return true; } public function loginWithUsername(string $username, string $password) : string { - $userObject = $this->db->select("utente", ["nomeUtente" => $username])[0]; + $query = $this->db->select("utente", ["nomeUtente" => $username]); - if(!$userObject){ + if(!$query){ return false; } + $userObject = $query[0]; + $this->id = $userObject["id"]; $this->username = $userObject["nomeUtente"]; $this->email = $userObject["email"];