/**
  * @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);
 }
Ejemplo n.º 2
0
 /**
  * @param string $oauth_verifier
  * @return array
  */
 public function getToken($oauth_verifier)
 {
     $connection = new \Abraham\TwitterOAuth\TwitterOAuth($this->app_key, $this->app_secret, $this->session->getData('oauth_token'), $this->session->getData('oauth_token_secret'));
     $access_token = $connection->oauth("oauth/access_token", array("oauth_verifier" => $oauth_verifier));
     $connection = new \Abraham\TwitterOAuth\TwitterOAuth($this->app_key, $this->app_secret, $access_token['oauth_token'], $access_token['oauth_token_secret']);
     $credentials = $connection->get('/account/verify_credentials', ['include_entities' => true, 'skip_status' => true, 'include_email' => true]);
     $access_token['since_id'] = $credentials;
     return $access_token;
 }
Ejemplo n.º 3
0
 /**
  * Hooks into the editable viewhelper to render those attributes needed for the package's inline editing
  *
  * @Flow\Around("method(TYPO3\Neos\Service\ContentElementEditableService->wrapContentProperty())")
  * @param JoinPointInterface $joinPoint the join point
  * @return mixed
  */
 public function editableElementAugmentation(JoinPointInterface $joinPoint)
 {
     if (!$this->session->isStarted() || !$this->session->getData('__neosEnabled__')) {
         return $joinPoint->getAdviceChain()->proceed($joinPoint);
     }
     $property = $joinPoint->getMethodArgument('property');
     $node = $joinPoint->getMethodArgument('node');
     $content = $joinPoint->getAdviceChain()->proceed($joinPoint);
     $attributes = ['data-__neos-property' => $property];
     if ($node !== null) {
         $attributes += ['data-__neos-editable-node-contextpath' => $node->getContextPath()];
     }
     return $this->htmlAugmenter->addAttributes($content, $attributes, 'span');
 }
 /**
  *
  * @param string $workspaceName
  * @return NodeInterface
  */
 protected function getLastVisitedNode($workspaceName)
 {
     if (!$this->session->isStarted() || !$this->session->hasKey('lastVisitedNode')) {
         return null;
     }
     try {
         $lastVisitedNode = $this->propertyMapper->convert($this->session->getData('lastVisitedNode'), NodeInterface::class);
         $q = new FlowQuery([$lastVisitedNode]);
         $lastVisitedNodeUserWorkspace = $q->context(['workspaceName' => $workspaceName])->get(0);
         return $lastVisitedNodeUserWorkspace;
     } catch (\Exception $exception) {
         return null;
     }
 }
Ejemplo n.º 5
0
 public function isRemembered()
 {
     return $this->session->hasKey("recaptcha_timestamp") && $this->session->getData("recaptcha_timestamp") > time() - (int) $this->settings["security"]["validTime"];
 }
 public function enableNewBackend()
 {
     return $this->session->isStarted() && $this->session->getData('__cheEnabled__');
 }
Ejemplo n.º 7
0
 /**
  * @param string $social
  * @return void
  */
 public function socialAction($social = NULL)
 {
     $args = $this->request->getArguments();
     switch ($social) {
         case "facebook":
             if ($args['connectorjson'] !== NULL) {
                 $response = json_decode($args['connectorjson'], true);
                 $token = $response['accessToken'];
                 $facebookAccounts = $this->facebookService->getAccounts($token);
                 $facebookImage = "https:////graph.facebook.com/" . $facebookAccounts['id'] . "/picture?type=large";
                 $this->createSocialAccount('facebook-' . $facebookAccounts['id'], $facebookAccounts['id'], $facebookAccounts['id'], $facebookAccounts['first_name'], $facebookAccounts['last_name'], $facebookImage, $facebookAccounts['email'], $network = "facebook", $args['return_url']);
             } else {
                 $this->addFlashMessage("access_denied");
                 $this->redirect('index', 'Standard');
             }
             break;
         case "vk":
             if (isset($args['code']) && $args['code'] !== NULL) {
                 $token = $this->vkService->getToken($args['code']);
                 if (isset($token['error']) && $token['error'] != NULL) {
                     $this->addFlashMessage($token['error']);
                     $this->redirect('index', 'Standard');
                 }
                 $data = json_decode($token);
                 $vkAccounts = $this->vkService->getAccounts($data->access_token, $data->user_id);
                 if ($args['state'] !== null) {
                     $returnUrl = $this->base64UrlDecode($args['state']);
                 }
                 $this->createSocialAccount('vk-' . $vkAccounts['response'][0]['uid'], $vkAccounts['response'][0]['uid'], $vkAccounts['response'][0]['uid'], $vkAccounts['response'][0]['first_name'], $vkAccounts['response'][0]['last_name'], $vkAccounts['response'][0]['photo_big'], $data->email, $network = "vk", $returnUrl);
             } else {
                 $this->addFlashMessage("access_denied");
                 $this->redirect('index', 'Standard');
             }
             break;
         case "googleplus":
             if (isset($args['code']) && $args['code'] !== NULL) {
                 $token = $this->googlePlusService->getToken($args['code']);
                 if (!isset($token->access_token)) {
                     $this->addFlashMessage($token->error_description);
                     $this->redirect('index', 'Standard');
                 }
                 $googleAccounts = $this->googlePlusService->getAccounts($token->access_token);
                 if ($args['state'] !== null) {
                     $returnUrl = $this->base64UrlDecode($args['state']);
                 }
                 $this->createSocialAccount('googlePlus-' . $googleAccounts['id'], $googleAccounts['id'], $googleAccounts['id'], $googleAccounts['name']['familyName'], $googleAccounts['name']['givenName'], $googleAccounts['image']['url'], $googleAccounts['emails'][0]['value'], $network = "googlePlus", $returnUrl);
             } else {
                 $this->addFlashMessage("access_denied");
                 $this->redirect('index', 'Standard');
             }
             break;
         case "twitter":
             if (isset($args['oauth_verifier']) && $args['oauth_verifier'] !== NULL) {
                 $response = $this->twitterService->getToken($args['oauth_verifier']);
                 $returnUrl = $this->base64UrlDecode($this->session->getData('return_url'));
                 if ($response !== NULL) {
                     $user_id = $response['user_id'];
                     $fullName = explode(" ", $response['since_id']->name);
                     $this->createSocialAccount('twitter-' . $user_id, $user_id, $user_id, $fullName[0], $fullName[1], $response['since_id']->profile_image_url, '', $network = "twitter", $returnUrl);
                 }
             } else {
                 $this->addFlashMessage('Something get wrong. Please, try again.', "Error", 'Error');
                 $this->redirect('index', 'Standard');
             }
             break;
     }
 }