fix: user token error

This commit is contained in:
Johannes Kantz 2023-01-25 08:32:42 +01:00
parent b84c4fd8e3
commit 34aa9e10f9

View File

@ -40,10 +40,12 @@ class User {
return $this->token; return $this->token;
} }
public function loginWithToken(string $token){ public function loginWithToken(string $token){
$userObject = $this->db->select("utente", ["gettone" => $token])[0]; $query = $this->db->select("utente", ["gettone" => $token]);
if(!$userObject){ if(!$query){
return false; return false;
} }
$userObject = $query[0];
$this->id = $userObject["id"]; $this->id = $userObject["id"];
$this->username = $userObject["nomeUtente"]; $this->username = $userObject["nomeUtente"];
$this->email = $userObject["email"]; $this->email = $userObject["email"];