fix login error

This commit is contained in:
Johannes Kantz 2023-01-25 08:16:44 +01:00
parent abc1be3885
commit 20a26ebd66

View File

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