public function createAction(\TYPO3\CMS\Extbase\Domain\Model\FrontendUser $feUser)
 {
     //TODO prüfen ob username doppelt vergeben wird.
     if ($feUser->getPassword() == $this->request->getArgument('passwordConfirmation')) {
         $feUser->setPid($this->settings['pidFrontendUser']);
         $feUser->_setProperty('tx_extbase_type', 'Tx_Extbase_Domain_Model_FrontendUser');
         $feUser->addUserGroup($this->frontendUserGroupRepository->findByUid($this->settings['frontendUserGroup']));
         $this->frontendUserRepository->add($feUser);
         //it is not persistent already, we have to do it!
         $persistenceManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager');
         $persistenceManager->persistAll();
         //now feuser ist persistent
         // Message for User
         $GLOBALS['TSFE']->fe_user->setKey("ses", "feuserCreate", 'Der User <b>' . $feUser->getUsername() . '</b> wurde neu angelegt.');
         $redirectParams['feUser'] = $feUser;
         $this->redirect('successUpdate', 'FrontendUser', NULL, $redirectParams);
     } else {
         $GLOBALS['TSFE']->fe_user->setKey("ses", "feuserCreate", 'Das Passwort stimmt nicht überein.');
         $GLOBALS['TSFE']->fe_user->setKey("ses", "feuserData", array('username' => $feUser->getUsername()));
         $redirectParams['feUser'] = $feUser;
         $this->redirect('new', 'FrontendUser', NULL, array());
     }
 }
 /**
  * Generates new temporary user
  *
  * @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
  *
  * @return \Abra\Cadabra\Domain\Model\FrontendUser
  */
 protected function createTemporaryUser()
 {
     $username = $this->createUniqueUserName();
     $user = new \Abra\Cadabra\Domain\Model\FrontendUser();
     $user->setUsername($username);
     $user->setPassword(sha1(time()));
     $userGroupId = $this->settings['frontendUser']['temporaryFrontendUserGroupId'];
     /** @var \TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup $userGroup */
     $userGroup = $this->frontendUserGroupRepository->findByIdentifier($userGroupId);
     $user->addUsergroup($userGroup);
     $user->setTemporaryUser(true);
     $this->frontendUserRepository->add($user);
     $this->persistenceManager->persistAll();
     return $user;
 }