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"];