/**
  * Create action
  *
  * @param \Planetflow3\Domain\Model\User $user
  * @param \Planetflow3\Domain\Dto\UserPassword $userPassword
  * @FLOW3\Validate("$userPassword", type="Planetflow3\Domain\Validator\CreateUserPasswordValidator")
  */
 public function createAction(\Planetflow3\Domain\Model\User $user, \Planetflow3\Domain\Dto\UserPassword $userPassword)
 {
     $user->setPassword($userPassword->getPassword());
     $this->userRepository->add($user);
     $this->addFlashMessage('User created.', 'Success', \TYPO3\FLOW3\Error\Message::SEVERITY_OK);
     $this->redirect('index');
 }
 /**
  * Create a user for administration
  *
  * The user will get the SystemAdministrator role to manage all data and users.
  *
  * @param string $emailAddress E-mail address (account identifier) of the new user
  * @return void
  */
 public function createUserCommand($emailAddress)
 {
     $uuid = \TYPO3\FLOW3\Utility\Algorithms::generateUUID();
     $password = substr($uuid, 0, 10);
     $user = new \Planetflow3\Domain\Model\User();
     $user->setEmailAddress($emailAddress);
     $user->setPassword($password);
     $user->setRole('SystemAdministrator');
     $this->userRepository->add($user);
     echo "Password: {$password}" . PHP_EOL;
 }