/**
  * @Flow\Session(autoStart = TRUE) 
  */
 public function step2Action()
 {
     $form = $this->request->getInternalArgument('__form');
     $data = $this->requestToArray();
     $captcha = $this->session->getData('captcha');
     if ($captcha !== $_POST['captcha']) {
         $this->addFlashMessage('Kontrollcode leider falsch.', null, \TYPO3\Flow\Error\Message::SEVERITY_WARNING);
         $this->systemLogger->log('Wrong captcha', LOG_INFO);
         $this->forward('step1');
     } else {
         if ($data === false) {
             $this->forward('step1');
         }
     }
     $processed = $this->session->getData('processed');
     if ($processed !== true) {
         $this->systemLogger->log('Process new form', LOG_INFO);
         $actions = $this->settings['forms'][$form]['actions'];
         foreach ($actions as $action => $config) {
             switch ($action) {
                 case 'email':
                     $this->processEmailAction($config, $data);
                     break;
             }
         }
         $this->systemLogger->log('Form processed', LOG_INFO);
         $this->session->putData('processed', true);
         $this->addFlashMessage('Formular erfolgreich verarbeitet.', null, \TYPO3\Flow\Error\Message::SEVERITY_OK);
     } else {
         $this->addFlashMessage('Dieses Formular wurde schon verarbeitet und wurde aus diesem Grund nicht erneut gesendet. Vermutlich haben Sie diese Seite neu geladen.', null, \TYPO3\Flow\Error\Message::SEVERITY_NOTICE);
     }
     $this->view->assign('data', $data);
     $this->view->assign('form', $form);
 }
Exemplo n.º 2
0
 /**
  * @param string $returnUrl
  * @return string
  */
 public function getAuthorizationUri($returnUrl = NULL)
 {
     $connection = new \Abraham\TwitterOAuth\TwitterOAuth($this->app_key, $this->app_secret);
     $request_token = $connection->oauth('oauth/request_token', array('oauth_callback' => $this->redirect_uri));
     $this->session->putData('return_url', $returnUrl);
     $this->session->putData('oauth_token', $request_token['oauth_token']);
     $this->session->putData('oauth_token_secret', $request_token['oauth_token_secret']);
     $url = $connection->url('oauth/authorize', array('oauth_token' => $request_token['oauth_token']));
     return $url;
 }
 /**
  * Shows the specified node and takes visibility and access restrictions into
  * account.
  *
  * @param NodeInterface $node
  * @return string View output for the specified node
  * @Flow\SkipCsrfProtection We need to skip CSRF protection here because this action could be called with unsafe requests from widgets or plugins that are rendered on the node - For those the CSRF token is validated on the sub-request, so it is safe to be skipped here
  * @Flow\IgnoreValidation("node")
  * @throws NodeNotFoundException
  */
 public function showAction(NodeInterface $node = NULL)
 {
     if ($node === NULL) {
         throw new NodeNotFoundException('The requested node does not exist or isn\'t accessible to the current user', 1430218623);
     }
     if (!$node->getContext()->isLive() && !$this->privilegeManager->isPrivilegeTargetGranted('TYPO3.Neos:Backend.GeneralAccess')) {
         $this->redirect('index', 'Login', NULL, array('unauthorized' => TRUE));
     }
     $inBackend = $node->getContext()->isInBackend();
     if ($node->getNodeType()->isOfType('TYPO3.Neos:Shortcut') && !$inBackend) {
         $this->handleShortcutNode($node);
     }
     $this->view->assign('value', $node);
     if ($inBackend) {
         $this->overrideViewVariablesFromInternalArguments();
         /** @var UserInterfaceMode $renderingMode */
         $renderingMode = $node->getContext()->getCurrentRenderingMode();
         $this->response->setHeader('Cache-Control', 'no-cache');
         if ($renderingMode !== NULL) {
             // Deprecated TypoScript context variable from version 2.0.
             $this->view->assign('editPreviewMode', $renderingMode->getTypoScriptPath());
         }
         if (!$this->view->canRenderWithNodeAndPath()) {
             $this->view->setTypoScriptPath('rawContent');
         }
     }
     if ($this->session->isStarted() && $inBackend) {
         $this->session->putData('lastVisitedNode', $node->getContextPath());
     }
 }
 /**
  * @param \Peytz\Vote\Domain\Model\Vote $newVote
  * @return void
  */
 public function registerAction(Vote $newVote)
 {
     if (!$this->session->isStarted()) {
         $this->session->start();
     }
     /** @var \Peytz\Vote\Domain\Model\Vote $vote */
     if ($vote = $this->voteRepository->findOneBySession($this->session->getId())) {
         $vote->setDate(new \DateTime());
         $vote->setValue($newVote->getValue());
         $this->voteRepository->update($vote);
     } else {
         $newVote->setDate(new \DateTime());
         $newVote->setSession($this->session->getId());
         $this->voteRepository->add($newVote);
     }
     $this->session->putData('hasVoted', true);
     $this->addFlashMessage('Vote registered.');
     $this->redirect('index');
 }
 /**
  * Is called if authentication was successful.
  *
  * @param ActionRequest $originalRequest The request that was intercepted by the security framework, NULL if there was none
  * @return void
  */
 public function onAuthenticationSuccess(ActionRequest $originalRequest = null)
 {
     if ($this->view instanceof JsonView) {
         $this->view->assign('value', array('success' => $this->authenticationManager->isAuthenticated(), 'csrfToken' => $this->securityContext->getCsrfProtectionToken()));
     } else {
         if ($this->request->hasArgument('lastVisitedNode') && strlen($this->request->getArgument('lastVisitedNode')) > 0) {
             $this->session->putData('lastVisitedNode', $this->request->getArgument('lastVisitedNode'));
         }
         if ($originalRequest !== null) {
             // Redirect to the location that redirected to the login form because the user was nog logged in
             $this->redirectToRequest($originalRequest);
         }
         $this->redirect('index', 'Backend\\Backend');
     }
 }
 /**
  * Displays the backend interface
  *
  * @param NodeInterface $node The node that will be displayed on the first tab
  * @return void
  */
 public function indexAction(NodeInterface $node = null)
 {
     $this->contentCache->flush();
     $this->session->start();
     $this->session->putData('__cheEnabled__', true);
     if ($user = $this->userService->getBackendUser()) {
         $workspaceName = $this->userService->getPersonalWorkspaceName();
         $contentContext = $this->createContext($workspaceName);
         $contentContext->getWorkspace();
         $this->persistenceManager->persistAll();
         $siteNode = $contentContext->getCurrentSiteNode();
         if ($node === null) {
             $node = $siteNode;
         }
         $this->view->assign('user', $user);
         $this->view->assign('documentNode', $node);
         $this->view->assign('site', $node);
         $this->view->assign('translations', $this->xliffService->getCachedJson(new Locale($this->userService->getInterfaceLanguage())));
         return;
     }
     $this->redirectToUri($this->uriBuilder->uriFor('index', array(), 'Login', 'TYPO3.Neos'));
 }
 /**
  * @param string $actionName Name of the action to forward to
  * @param string $controllerName Unqualified object name of the controller to forward to. If not specified, the current controller is used.
  * @param string $packageKey Key of the package containing the controller to forward to. If not specified, the current package is assumed.
  * @param array $arguments Array of arguments for the target action
  * @param integer $delay (optional) The delay in seconds. Default is no delay.
  * @param integer $statusCode (optional) The HTTP status code for the redirect. Default is "303 See Other"
  * @param string $format The format to use for the redirect URI
  * @return void
  */
 protected function unsetLastVisitedNodeAndRedirect($actionName, $controllerName = null, $packageKey = null, array $arguments = null, $delay = 0, $statusCode = 303, $format = null)
 {
     $this->session->putData('lastVisitedNode', null);
     parent::redirect($actionName, $controllerName, $packageKey, $arguments, $delay, $statusCode, $format);
 }
 /**
  * @Flow\Before("method(TYPO3\Neos\Controller\Backend\BackendController->indexAction())")
  * @param JoinPointInterface $joinPoint the join point
  * @return mixed
  */
 public function disableNewUserInterface(JoinPointInterface $joinPoint)
 {
     $this->contentCache->flush();
     $this->session->start();
     $this->session->putData('__cheEnabled__', false);
 }
Exemplo n.º 9
0
 /**
  * If a captcha is remembered as solved correctly, this function resets this memory. Use
  * this always if you use validate(remember = true).
  */
 public function invalidate()
 {
     $this->session->putData("recaptcha_timestamp", 0);
 }