Example #1
0
 /**
  * action create
  *
  * @param User $user
  * @validate $user In2code\Femanager\Domain\Validator\ServersideValidator
  * @validate $user In2code\Femanager\Domain\Validator\PasswordValidator
  * @validate $user In2code\Femanager\Domain\Validator\CaptchaValidator
  * @return void
  */
 public function createAction(User $user)
 {
     $user = UserUtility::overrideUserGroup($user, $this->settings);
     $user = FrontendUtility::forceValues($user, $this->config['new.']['forceValues.']['beforeAnyConfirmation.']);
     $user = UserUtility::fallbackUsernameAndPassword($user);
     $user = UserUtility::takeEmailAsUsername($user, $this->settings);
     UserUtility::hashPassword($user, $this->settings['new']['misc']['passwordSave']);
     $this->signalSlotDispatcher->dispatch(__CLASS__, __FUNCTION__ . 'BeforePersist', [$user, $this]);
     if ($this->isAllConfirmed()) {
         $this->createAllConfirmed($user);
     } else {
         $this->createRequest($user);
     }
 }
 /**
  * action update
  *
  * @param \Gigabonus\Gbfemanager\Domain\Model\User $user
  * @param string $forgothash
  * @validate $user In2code\Femanager\Domain\Validator\ServersideValidator
  * @validate $user In2code\Femanager\Domain\Validator\PasswordValidator
  * @return void
  */
 public function saveAction(\Gigabonus\Gbfemanager\Domain\Model\User $user, $forgothash = null)
 {
     $compareHash = $this->getCompareHash($forgothash);
     if ($compareHash === NULL) {
         exit;
     }
     if ($compareHash[0] < time()) {
         /**
          * @todo: change_password_notvalid_message
          */
         $this->view->assign('changePasswordNotvalid', TRUE);
     } else {
         UserUtility::convertPassword($user, $this->settings['edit']['misc']['passwordSave']);
         // Save new password and clear DB-hash
         $GLOBALS['TYPO3_DB']->exec_UPDATEquery('fe_users', 'felogin_forgothash="' . $compareHash[0] . '|' . md5($compareHash[1]) . '"', array('password' => $user->getPassword(), 'felogin_forgotHash' => '', 'tstamp' => $GLOBALS['EXEC_TIME']));
         $count = $GLOBALS['TYPO3_DB']->sql_affected_rows();
         // $this->userRepository->update($user);
         // $this->persistenceManager->persistAll();
         if ($count > 0) {
             $this->addFlashMessage('Password changed');
         }
     }
     // $this->redirectToUri('/ru/my-account/login/');
 }
 /**
  * Check if user is allowed to see this action
  *
  * @return bool
  */
 protected function allowedUserForInvitationNewAndCreate()
 {
     if (empty($this->settings['invitation']['allowedUserGroups'])) {
         return true;
     }
     $allowedUsergroupUids = GeneralUtility::trimExplode(',', $this->settings['invitation']['allowedUserGroups'], true);
     $currentUsergroupUids = UserUtility::getCurrentUsergroupUids();
     // compare allowedUsergroups with currentUsergroups
     if (count(array_intersect($allowedUsergroupUids, $currentUsergroupUids))) {
         return true;
     }
     // current user is not allowed
     $this->addFlashMessage(LocalizationUtility::translateByState(Log::STATUS_INVITATIONRESTRICTEDPAGE), '', FlashMessage::ERROR);
     $this->forward('status');
     return false;
 }
Example #4
0
 /**
  * Check if last FE login was within the last 2h
  * 
  * @return boolean
  */
 public function isOnline()
 {
     if (method_exists($this->getLastlogin(), 'getTimestamp') && $this->getLastlogin()->getTimestamp() > time() - 2 * 60 * 60 && UserUtility::checkFrontendSessionToUser($this)) {
         return true;
     }
     return $this->isOnline;
 }
 /**
  * action user logout
  *
  * @param User $user
  * @return void
  */
 public function userLogoutAction(User $user)
 {
     UserUtility::removeFrontendSessionToUser($user);
     $this->addFlashMessage('User successfully logged out');
     $this->redirect('list');
 }
Example #6
0
 /**
  * Init
  *
  * @return void
  */
 public function initializeAction()
 {
     $this->databaseConnection = $GLOBALS['TYPO3_DB'];
     $this->controllerContext = $this->buildControllerContext();
     $this->user = UserUtility::getCurrentUser();
     $this->contentObject = $this->configurationManager->getContentObject();
     $this->pluginVariables = $this->request->getArguments();
     $this->allConfig = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
     $this->config = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
     $this->config = $this->config['plugin.']['tx_femanager.']['settings.'];
     $controllerName = strtolower($this->controllerContext->getRequest()->getControllerName());
     $removeFromUserGroupSelection = $this->settings[$controllerName]['misc']['removeFromUserGroupSelection'];
     $this->allUserGroups = $this->userGroupRepository->findAllForFrontendSelection($removeFromUserGroupSelection);
     if (isset($this->arguments['user'])) {
         $this->arguments['user']->getPropertyMappingConfiguration()->forProperty('dateOfBirth')->setTypeConverterOption('TYPO3\\CMS\\Extbase\\Property\\TypeConverter\\DateTimeConverter', DateTimeConverter::CONFIGURATION_DATE_FORMAT, LocalizationUtility::translate('tx_femanager_domain_model_user.dateFormat'));
     }
     // check if ts is included
     if ($this->settings['_TypoScriptIncluded'] !== '1' && !GeneralUtility::_GP('eID') && TYPO3_MODE !== 'BE') {
         $this->addFlashMessage(LocalizationUtility::translate('error_no_typoscript'), '', FlashMessage::ERROR);
     }
     // check if storage pid was set
     if ((int) $this->allConfig['persistence']['storagePid'] === 0 && !GeneralUtility::_GP('eID') && TYPO3_MODE !== 'BE') {
         $this->addFlashMessage(LocalizationUtility::translate('error_no_storagepid'), '', FlashMessage::ERROR);
     }
 }
Example #7
0
 /**
  * Simulate frontenduser login for backend adminstrators only
  *
  * @param User $user
  * @throws UnauthorizedException
  * @return void
  */
 public function loginAsAction(User $user)
 {
     if (!BackendUserUtility::isAdminAuthentication()) {
         throw new UnauthorizedException(LocalizationUtility::translate('error_not_authorized'));
     }
     UserUtility::login($user);
     $this->redirectByAction('loginAs', 'redirect');
     $this->redirectToUri('/');
 }
Example #8
0
 /**
  * action update
  *
  * @param User $user
  * @validate $user In2code\Femanager\Domain\Validator\ServersideValidator
  * @validate $user In2code\Femanager\Domain\Validator\PasswordValidator
  * @validate $user In2code\Femanager\Domain\Validator\CaptchaValidator
  * @return void
  */
 public function updateAction(User $user)
 {
     $this->redirectIfDirtyObject($user);
     $user = FrontendUtility::forceValues($user, $this->config['edit.']['forceValues.']['beforeAnyConfirmation.']);
     $this->emailForUsername($user);
     UserUtility::convertPassword($user, $this->settings['edit']['misc']['passwordSave']);
     $this->signalSlotDispatcher->dispatch(__CLASS__, __FUNCTION__ . 'BeforePersist', [$user, $this]);
     if (!empty($this->settings['edit']['confirmByAdmin'])) {
         $this->updateRequest($user);
     } else {
         $this->updateAllConfirmed($user);
     }
     $this->redirect('edit');
 }
Example #9
0
 /**
  * Convert password to md5 or sha1 hash
  *
  * @param User $user
  * @param string $method
  * @return void
  */
 public static function convertPassword(User $user, $method)
 {
     if (array_key_exists('password', UserUtility::getDirtyPropertiesFromUser($user))) {
         self::hashPassword($user, $method);
     }
 }