Added a console command to set the password of a user.

This commit is contained in:
Jan Böhmer 2019-03-20 12:27:11 +01:00
parent 10f39b7f45
commit f31336bb87
2 changed files with 118 additions and 0 deletions

View file

@ -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