diff --git a/User.php b/User.php index ca43bd2..2006ccc 100644 --- a/User.php +++ b/User.php @@ -40,10 +40,12 @@ class User { return $this->token; } public function loginWithToken(string $token){ - $userObject = $this->db->select("utente", ["gettone" => $token])[0]; - if(!$userObject){ + $query = $this->db->select("utente", ["gettone" => $token]); + if(!$query){ return false; } + $userObject = $query[0]; + $this->id = $userObject["id"]; $this->username = $userObject["nomeUtente"]; $this->email = $userObject["email"];