mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-23 02:09:03 +02:00
Added a console command to set the password of a user.
This commit is contained in:
parent
10f39b7f45
commit
f31336bb87
2 changed files with 118 additions and 0 deletions
|
@ -74,6 +74,12 @@ class User extends NamedDBElement implements UserInterface, HasPermissionsInterf
|
|||
*/
|
||||
protected $password;
|
||||
|
||||
/**
|
||||
* @var bool True if the user needs to change password after log in
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
protected $need_pw_change;
|
||||
|
||||
/**
|
||||
* @var string|null The first name of the User
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
|
@ -228,6 +234,23 @@ class User extends NamedDBElement implements UserInterface, HasPermissionsInterf
|
|||
* Getters
|
||||
************************************************/
|
||||
|
||||
/**
|
||||
* Returns the full name in the format FIRSTNAME LASTNAME [(USERNAME)].
|
||||
* Example: Max Muster (m.muster)
|
||||
* @param bool $including_username Include the username in the full name.
|
||||
* @return string A string with the full name of this user.
|
||||
*/
|
||||
public function getFullName(bool $including_username = false)
|
||||
{
|
||||
$str = $this->getFirstName() . ' ' . $this->getLastName();
|
||||
if ($including_username) {
|
||||
$str .= ' (' . $this->getName() . ')';
|
||||
}
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
|
||||
public function setName(string $new_name) : NamedDBElement
|
||||
{
|
||||
// Anonymous user is not allowed to change its username
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue