This repository has been archived on 2023-01-06. You can view files and clone it, but cannot push or open issues or pull requests.
web/app/core/User.php
2022-01-23 22:56:36 +01:00

29 lines
661 B
PHP

<?php
// TODO: ...
class User
{
private Session $session;
public ?bool $loggedIn;
public ?string $username;
public function __construct(Session $session)
{
$this->session = $session;
$this->loggedIn = $this->session->get('loggedIn');
$this->username = $this->session->get('username');
}
public function login(string $username, string $password): bool
{
if ($username === 'William' && $password === 'William')
{
$this->session->set('loggedIn', TRUE);
$this->session->set('username', 'William');
return TRUE;
}
return FALSE;
}
}