コード例 #1
0
 /**
  * {@inheritdoc}
  *
  * @param FlowQuery $flowQuery The FlowQuery object
  * @param array $arguments None
  * @return integer The cache lifetime in seconds or NULL if either no content collection was given or no child node had a "hiddenBeforeDateTime" or "hiddenAfterDateTime" property set
  */
 public function evaluate(FlowQuery $flowQuery, array $arguments)
 {
     $minimumDateTime = null;
     foreach ($flowQuery->getContext() as $contextNode) {
         $hiddenBeforeDateTime = $contextNode->getHiddenBeforeDateTime();
         if ($hiddenBeforeDateTime !== null && $hiddenBeforeDateTime > $this->now && ($minimumDateTime === null || $hiddenBeforeDateTime < $minimumDateTime)) {
             $minimumDateTime = $hiddenBeforeDateTime;
         }
         $hiddenAfterDateTime = $contextNode->getHiddenAfterDateTime();
         if ($hiddenAfterDateTime !== null && $hiddenAfterDateTime > $this->now && ($minimumDateTime === null || $hiddenAfterDateTime < $minimumDateTime)) {
             $minimumDateTime = $hiddenAfterDateTime;
         }
     }
     if ($minimumDateTime !== null) {
         $maximumLifetime = $minimumDateTime->getTimestamp() - $this->now->getTimestamp();
         if ($maximumLifetime > 0) {
             return $maximumLifetime;
         }
     }
     return null;
 }
コード例 #2
0
 /**
  * @param string $password,
  * @param string $passwordconfirm
  * @param string $code
  * @return string|void
  */
 public function changePasswordAction($password = NULL, $passwordconfirm = NULL, $code = NULL)
 {
     if ($code !== NULL) {
         $cryptJson = $code;
         $cryptKey = md5($this->providerName);
         $uncryptJson = base64_decode($cryptJson);
         $uncryptJson = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $cryptKey, $uncryptJson, MCRYPT_MODE_CBC, md5($cryptKey));
         $uncryptJson = rtrim($uncryptJson, "");
         $json = json_decode($uncryptJson);
     } else {
         $json = NULL;
     }
     $this->view->assign('code', $code);
     // @TODO Check if User has random number
     if ($json != NULL) {
         if ($this->time->getTimestamp() - $json->date > 86400) {
             $this->flashMessageContainer->addMessage(new \TYPO3\Flow\Error\Error($this->translator->translateById('login.messages.registration.not_valid', array(), NULL, NULL, 'Main', 'Incvisio.LostFound')));
             $this->redirect('index', 'Standard', NULL, array());
         } else {
             $account = $this->accountRepository->findByAccountIdentifierAndAuthenticationProviderName($json->username, $this->providerName);
             if ($password == $passwordconfirm && $password !== NULL) {
                 $account->setExpirationDate(NULL);
                 $account->setCredentialsSource($this->hashService->hashPassword($password, 'default'));
                 $this->accountRepository->update($account);
                 $this->flashMessageContainer->addMessage(new Message($this->translator->translateById('login.login.update', array(), NULL, NULL, 'Main', 'Incvisio.LostFound')));
                 $this->redirect('index', 'Standard', NULL, array());
             } else {
                 if ($password !== NULL) {
                     $this->flashMessageContainer->addMessage(new \TYPO3\Flow\Error\Error("Sorry"));
                 }
             }
         }
     } else {
         $this->flashMessageContainer->addMessage(new \TYPO3\Flow\Error\Error($this->translator->translateById('login.messages.registration.not_valid', array(), NULL, NULL, 'Main', 'Incvisio.LostFound')));
         $this->redirect('index', 'Standard', NULL, array());
     }
 }