fix: user construct on login

This commit is contained in:
grandeljay 2023-08-30 13:11:12 +02:00
parent 3355bd78b9
commit e9798a01fe
2 changed files with 13 additions and 10 deletions

View file

@ -114,8 +114,11 @@ class Page
}
/**
* Non-Static
* The page name. Is used for the HTML `title` and `h1` tags.
*
* @var string
*/
private string $name;
public string $language = DEFAULT_LOCALE;
public array $messages = array();
public string $link_preview;

View file

@ -96,9 +96,9 @@ class User
/**
* A unix timestamp of the users birthdate.
*
* @var int
* @var int|null
*/
private int $birthdate;
private ?int $birthdate;
/**
* More accurately, this is the users locale (e. g. `en_GB`).
@ -161,17 +161,17 @@ class User
$this->id = $fields['id'];
$this->email = $fields['email'];
$this->password = $fields['password'];
$this->password_reset_token = $fields['password_reset_token'];
$this->password_reset_valid_until = $fields['password_reset_valid_until'];
$this->last_login = $fields['last_login'];
$this->password_reset_token = $fields['password_reset_token'] ?? '';
$this->password_reset_valid_until = \strtotime($fields['password_reset_valid_until']);
$this->last_login = \strtotime($fields['last_login']);
$this->power = $fields['power'];
$this->birthdate = $fields['birthdate'];
$this->language = $fields['language'];
$this->currency = $fields['currency'];
$this->name_first = $fields['name_first'];
$this->name_last = $fields['name_last'];
$this->name_nick = $fields['name_nick'];
$this->channel = $fields['channel'];
$this->name_first = $fields['name_first'] ?? '';
$this->name_last = $fields['name_last'] ?? '';
$this->name_nick = $fields['name_nick'] ?? '';
$this->channel = $fields['channel'] ?? '';
$this->advertisements = $fields['advertisements'];
}