|
|
@ -15,14 +15,24 @@ class AuthGateway {
|
|
|
|
$this->con = $con;
|
|
|
|
$this->con = $con;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function insertAccount(string $username, string $hash, string $email) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function mailExist(string $email):bool{
|
|
|
|
|
|
|
|
return $this->getUserFields($email) != null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function insertAccount(string $username, string $hash, string $email) {
|
|
|
|
$this->con->exec("INSERT INTO AccountUser VALUES (:username,:hash,:email)", [':username' => [$username, PDO::PARAM_STR],':hash'=> [$hash, PDO::PARAM_STR],':email'=>[$email, PDO::PARAM_STR]]);
|
|
|
|
$this->con->exec("INSERT INTO AccountUser VALUES (:username,:hash,:email)", [':username' => [$username, PDO::PARAM_STR],':hash'=> [$hash, PDO::PARAM_STR],':email'=>[$email, PDO::PARAM_STR]]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function getUserFields (string $email):array{
|
|
|
|
|
|
|
|
return $this->con->fetch ("SELECT username,email FROM AccountUser WHERE email = :email",[':email'=>[$email, PDO::PARAM_STR]]);
|
|
|
|
public function getUserFields (string $email): ?array {
|
|
|
|
|
|
|
|
$results = $this->con->fetch ("SELECT username,email FROM AccountUser WHERE email = :email",[':email'=>[$email, PDO::PARAM_STR]]);
|
|
|
|
|
|
|
|
$firstRow = $results[0] ?? null;
|
|
|
|
|
|
|
|
return $firstRow;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|