/**
  * Checks, if a valid auth code was submitted and invalidates it
  *
  * @return array the GET/POST data array
  */
 public function process()
 {
     $authCode = $this->utils->getAuthCode();
     if (empty($authCode)) {
         $this->utilityFuncs->throwException('validateauthcode_insufficient_params');
     }
     $authCodeData = $this->utils->getAuthCodeDataFromDB($authCode);
     if (!isset($authCodeData)) {
         $this->utilityFuncs->throwException('validateauthcode_no_record_found');
     }
     $this->utils->clearAuthCodeFromSession();
     $this->authCodeRepository->clearAssociatedAuthCodes($authCodeData);
     $this->gp = $this->utils->clearAuthCodeFromGP($this->gp);
     return $this->gp;
 }
 /**
  * Checks, if a valid auth code was submitted and deletes the referenced record
  * from the database
  *
  * @return array the GET/POST data array
  */
 public function process()
 {
     $submittedAuthCode = $this->utils->getAuthCode();
     if (empty($submittedAuthCode)) {
         $this->utilityFuncs->throwException('validateauthcode_insufficient_params');
     }
     $authCode = $this->utils->getAuthCodeDataFromDB($submittedAuthCode);
     if (!isset($authCode)) {
         $this->utilityFuncs->throwException('validateauthcode_no_record_found');
     }
     $forceDeletion = TRUE;
     if (intval($this->settings['markAsDeleted'])) {
         $forceDeletion = FALSE;
     }
     $this->authCodeRecordRepository->removeAssociatedRecord($authCode, $forceDeletion);
     $this->authCodeRepository->clearAssociatedAuthCodes($authCode);
     $this->utils->clearAuthCodeFromSession();
     $this->gp = $this->utils->clearAuthCodeFromGP($this->gp);
     return $this->gp;
 }
 /**
  * Creates a tiny url if enabled in configuration and extension
  * is available
  */
 protected function generateTinyUrl()
 {
     if (!($this->settings['generateTinyUrl'] && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('tinyurls'))) {
         return;
     }
     if (!isset($this->tinyUrlApi)) {
         $this->tinyUrlApi = GeneralUtility::makeInstance(\Tx\Tinyurls\TinyUrl\Api::class);
     }
     $this->tinyUrlApi->setDeleteOnUse(1);
     $this->tinyUrlApi->setUrlKey($this->gp['generated_authCode']);
     $this->tinyUrlApi->setValidUntil($this->authCodeRepository->getValidUntil()->getTimestamp());
     $url = $this->gp['authCodeUrl'];
     $this->gp['authCodeUrl'] = $this->tinyUrlApi->getTinyUrl($url);
 }
 /**
  * Sets a new auth code expiry time.
  *
  * @param string $authCodeExpiryTime Time that will be parsed with strtotime
  * @throws \Exception if string can not be parsed
  * @deprecated Since 0.7.0, will be removed in version 1.0.0, use AuthCodeRepository instead.
  * @see \Tx\Authcode\Domain\Repository\AuthCodeRepository::setAuthCodeExpiryTime()
  */
 public function setAuthCodeExpiryTime($authCodeExpiryTime)
 {
     $this->authCodeRepository->setAuthCodeExpiryTime($authCodeExpiryTime);
 }