From 34aa9e10f913ca3e20dd18366d0e0bcd80009617 Mon Sep 17 00:00:00 2001 From: Johannes Kantz <67144859+JohannesKantz@users.noreply.github.com> Date: Wed, 25 Jan 2023 08:32:42 +0100 Subject: [PATCH] fix: user token error --- User.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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"];