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