mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58:41 +00:00
Add password feature
This commit is contained in:
parent
695f1623b1
commit
9ccdf2a5f2
|
|
@ -124,6 +124,14 @@ class Account implements ArrayableInterface, \JsonSerializable
|
|||
*/
|
||||
protected $groups = [];
|
||||
|
||||
/**
|
||||
* Password.
|
||||
*
|
||||
* @var Password
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $password = '';
|
||||
|
||||
/**
|
||||
* Account type.
|
||||
*
|
||||
|
|
@ -326,6 +334,21 @@ class Account implements ArrayableInterface, \JsonSerializable
|
|||
return $this->createdAt ?? new \DateTime('NOW');
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate password.
|
||||
*
|
||||
* @param string $password Password
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function generatePassword(string $password) /* : void */
|
||||
{
|
||||
$this->password = password_hash($password, PASSWORD_DEFAULT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name.
|
||||
*
|
||||
|
|
@ -487,7 +510,7 @@ class Account implements ArrayableInterface, \JsonSerializable
|
|||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->jsonSerialize();
|
||||
return json_encode($this->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -500,7 +523,7 @@ class Account implements ArrayableInterface, \JsonSerializable
|
|||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return json_encode($this->toArray());
|
||||
return $this->toArray();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user