Example #1
0
 /**
  * Verifica si la peticion actual contiene y es valido el token de proteccion CSRF 
  * 
  * @return boolean
  * @throws \Raptor\Exception\Csrf
  */
 public function hasCsrfProtection()
 {
     if ($this->app->getSecurity()->verifyToken($this->app->request()->params('token'))) {
         return true;
     } else {
         throw new \Raptor\Exception\Csrf("The Token specified in the request object is invalid<br>Espected: " . $this->app->getSecurity()->getToken() . "<br> This given: " . $this->app->request()->params('token'));
     }
 }
Example #2
0
 public function call(\Raptor\Raptor $app)
 {
     /**
      * Add to the inyector container the Interactive Instance
      * 
      */
     $app->getInyector()->add(new \Raptor2\InteractiveBundle\Manager\InteractiveManager());
     $user = '******';
     if ($app->getSecurity()->isAuthenticated()) {
         $array = $app->getSecurity()->getUser();
         $user = $array['username'];
     }
     $store = json_encode(array('reject' => false, 'tutoriales' => array('interactive' => 'This is interactive')));
     if ($app->getCookie('Interactive_' . $user, true) == NULL) {
         $app->setCookie('Interactive_' . $user, $store, strtotime('+1 year'));
     } else {
         $store = $app->getCookie('Interactive_' . $user, true);
     }
     $app->setViewPlugin('core_library_outside', $app->render("@InteractiveBundle/core/core.js.twig", array('url' => $app->request()->getUrl() . $app->request()->getScriptName() . '/interactive/core', 'perfil' => $store)));
     /**
      * Return false to continue the flow of routing
      */
     return false;
 }