/** * @param \CIC\Cicregister\Domain\Model\FrontendUser $frontendUser * @param array $conf * @return string */ public function execute(\CIC\Cicregister\Domain\Model\FrontendUser $frontendUser, array $conf) { // This method generates a login hash, which gets validated in the authentication service. // The login hash is part of a query string that the user is redirected to. $hashValidator = $this->objectManager->get('CIC\\Cicregister\\Service\\HashValidator'); $loginHash = $hashValidator->generateShortLivedKey($frontendUser->getUid()); $uriBuilder = $this->controllerContext->getUriBuilder(); $returnUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('return_url'); $uri = $uriBuilder->reset()->setTargetPageUid($conf['forwardPid'])->setLinkAccessRestrictedPages(true)->setNoCache(false)->setUseCacheHash(false)->setArguments(array('return_url' => $returnUrl, 'logintype' => 'login', 'pid' => $conf['feuserPid'], 'loginHash' => $loginHash))->uriFor($conf['forwardAction'], NULL, 'FrontendUser'); $response = $this->objectManager->create('CIC\\Cicregister\\Behaviors\\Response\\RedirectURI'); $response->setValue($uri); return $response; }
/** * @param \CIC\Cicregister\Domain\Model\FrontendUser $frontendUser * @param null $rand * @return string */ public function generateKey(\CIC\Cicregister\Domain\Model\FrontendUser $frontendUser, $rand = NULL) { if (!$rand) { $rand = mt_rand(); } $base = $this->salt . $frontendUser->getUid() . $rand . $frontendUser->getEmail(); $hash = md5($base); $key = $hash . '-' . $frontendUser->getUid() . '-' . $rand; return $key; }