Example #1
0
 /**
  * Return current logged in fe_user
  *
  * @return User
  */
 public function getCurrentUser()
 {
     if (!is_array($GLOBALS['TSFE']->fe_user->user)) {
         return NULL;
     }
     return $this->userRepository->findByUid($GLOBALS['TSFE']->fe_user->user['uid']);
 }
 /**
  * Some additional actions after profile creation
  *
  * @param User $user
  * @param string $action
  * @param string $redirectByActionName Action to redirect
  * @param bool $login Login after creation
  * @param string $status
  * @return void
  */
 public function finalCreate($user, $action, $redirectByActionName, $login = TRUE, $status = '')
 {
     // persist user (otherwise login is not possible if user is still disabled)
     $this->userRepository->update($user);
     $this->persistenceManager->persistAll();
     // login user
     if ($login) {
         $this->loginAfterCreate($user);
     }
     // send notify email to user
     $this->sendMail->send('createUserNotify', Div::makeEmailArray($user->getEmail(), $user->getFirstName() . ' ' . $user->getLastName()), array($this->settings['new']['email']['createUserNotify']['sender']['email']['value'] => $this->settings['settings']['new']['email']['createUserNotify']['sender']['name']['value']), 'Profile creation', array('user' => $user, 'settings' => $this->settings), $this->config['new.']['email.']['createUserNotify.']);
     // send notify email to admin
     if ($this->settings['new']['notifyAdmin']) {
         $this->sendMail->send('createNotify', Div::makeEmailArray($this->settings['new']['notifyAdmin'], $this->settings['new']['email']['createAdminNotify']['receiver']['name']['value']), Div::makeEmailArray($user->getEmail(), $user->getUsername()), 'Profile creation', array('user' => $user, 'settings' => $this->settings), $this->config['new.']['email.']['createAdminNotify.']);
     }
     // sendpost: send values via POST to any target
     Div::sendPost($user, $this->config, $this->cObj);
     // store in database: store values in any wanted table
     Div::storeInDatabasePreflight($user, $this->config, $this->cObj, $this->objectManager);
     // add signal after user generation
     $this->signalSlotDispatcher->dispatch(__CLASS__, __FUNCTION__ . 'AfterPersist', array($user, $action, $this));
     // frontend redirect (if activated via TypoScript)
     $this->redirectByAction($action, $status ? $status . 'Redirect' : 'redirect');
     // go to an action
     $this->redirect($redirectByActionName);
 }
Example #3
0
 /**
  * Validation for Unique in the db
  *
  * @param \string $value
  * @param \string $field Fieldname like "username" or "email"
  * @param \In2\Femanager\Domain\Model\User $user Existing User
  * @return \bool
  */
 protected function validateUniqueDb($value, $field, \In2\Femanager\Domain\Model\User $user = NULL)
 {
     $foundUser = $this->userRepository->checkUniqueDb($field, $value, $user);
     return !is_object($foundUser);
 }