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

29 lines
661 B
PHP
Raw Normal View History

2022-01-23 21:56:36 +00:00
<?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;
}
}