Example #1
0
 /**
  * Logs the user out.
  *
  * @access  public
  */
 public function logout()
 {
     $this->session->regenerateId();
     $this->session->remove($this->authKey);
     $this->response->deleteCookie($this->authKey, $this->cookieOptions);
     $this->user = null;
 }
Example #2
0
 /**
  * Get generated phrase
  *
  * @access  public
  * @return  string
  */
 public function regenerate($width = null, $height = null, $font = null)
 {
     // Builder options
     $width = is_null($width) ? $this->config->get('makocaptcha::config.width') : $width;
     $height = is_null($height) ? $this->config->get('makocaptcha::config.height') : $height;
     $font = is_null($font) ? $this->config->get('makocaptcha::config.font') : $font;
     // Destroy session
     $this->session->remove($this->secret . '::phrase');
     $this->session->remove($this->secret . '::lastModified');
     // Regenerate builder
     $this->setBuilder($width, $height, $font);
 }
 /**
  * {@inheritdoc}
  */
 public function register()
 {
     $this->container->registerSingleton(['mako\\session\\Session', 'session'], function ($container) {
         $config = $container->get('config')->get('session');
         $session = new Session($container->get('request'), $container->get('response'), $this->getSessionStore($container, $config));
         $session->setDataTTL($config['ttl']['data']);
         $session->setCookieTTL($config['ttl']['cookie']);
         $session->setCookieName($config['session_name']);
         $session->setCookieOptions($config['cookie_options']);
         $session->start();
         return $session;
     });
 }
 /**
  * Validates a one time token.
  *
  * @access  public
  * @param   string  $input Input
  * @return  boolean
  */
 public function validate($input)
 {
     return $this->session->validateOneTimeToken($input);
 }
 /**
  *
  */
 public function testDestroy()
 {
     $response = $this->getResponseSetCookie();
     $response->shouldReceive('deleteCookie')->once()->with('mako_session', ['path' => '/', 'domain' => '', 'secure' => false, 'httponly' => false]);
     $store = $this->getStore();
     $store->shouldReceive('read')->once()->with('foo123')->andReturn([]);
     $store->shouldReceive('delete')->once()->with('foo123');
     $session = new Session($this->getRequestWithCookie(), $response, $store);
     $session->start();
     $session->destroy();
 }