make it possible to have username

This commit is contained in:
bence committed 2023-04-09 02:29:46 +02:00
1 parent 366abf61b3
commit 151112bd2a
7 files changed
+44 -6

No files matched your search

+13 -1
View File
@@ -8,12 +8,14 @@ class User extends Model implements IUser
{
protected static string $table = 'users';
protected static array $fields = ['email', 'password', 'type', 'google_sub', 'created'];
protected static array $fields = ['email', 'username', 'password', 'type', 'google_sub', 'created'];
private static array $types = ['user', 'admin'];
private string $email = '';
private ?string $username = null;
private ?string $password = null;
private string $type = 'user';
@@ -27,6 +29,11 @@ class User extends Model implements IUser
$this->email = $email;
}
public function setUsername(?string $username): void
{
$this->username = $username;
}
public function setPassword(?string $hashedPassword): void
{
$this->password = $hashedPassword;
@@ -64,6 +71,11 @@ class User extends Model implements IUser
return $this->email;
}
public function getUsername(): ?string
{
return $this->username;
}
public function getPassword(): ?string
{
return $this->password;