Ejemplo n.º 1
1
 public function boot()
 {
     $this->request = core('request');
     $this->response = core('response');
     core('registry')->set('app.controller', $this);
     $this->csrf = Utils::token();
     session('front')->setCsrf($this->csrf);
 }
Ejemplo n.º 2
1
 public function __construct()
 {
     $this->token = Session::instance('ThinSession')->getAuthToken();
     if (is_null($this->token)) {
         $this->token = Utils::token();
         Session::instance('ThinSession')->setAuthToken($this->token);
     }
 }
Ejemplo n.º 3
0
 public function __construct($values = array())
 {
     if (is_object($values)) {
         $values = $values->assoc();
     }
     if (count($values)) {
         $this->values = $this->make($values);
     } else {
         $this->values = $values;
     }
     $this->_token = Utils::token();
 }
Ejemplo n.º 4
0
 public function __construct($ns, $store = 'Thin\\Store')
 {
     $ns = 'thin_' . $ns;
     $c = cookies()->{$ns};
     if (null === $c) {
         setcookie($ns, Utils::token(), strtotime('+1 year'));
     } else {
         setcookie($ns, $c, strtotime('+1 year'));
     }
     $this->key = cookies()->{$ns};
     if (empty($this->key)) {
         throw new Exception("Cookies must be functional to execute this class.");
     }
     $this->model($ns);
     $this->db = new $store('thin_forever_' . $ns);
     $this->fetch();
 }
Ejemplo n.º 5
0
 /**
  * Refresh the "remember me" token for the user.
  *
  * @return void
  */
 protected function refreshRememberToken($user)
 {
     $user->setToken($token = Utils::token())->save();
 }
Ejemplo n.º 6
0
 public function has($key)
 {
     $check = Utils::token();
     return $check != $this->get($key, $check);
 }
Ejemplo n.º 7
0
 public static function token()
 {
     return static::input('hidden', '_token', Utils::token());
 }
Ejemplo n.º 8
0
Archivo: qma.php Proyecto: noikiy/inovi
    {
        return container()->qbm($name);
    }
    public function truncate($str, $length = 20)
    {
        if (strlen($str) > $length) {
            $str = substr($str, 0, $length) . '…';
        }
        return $str;
    }
}
$test = new Quickdata('test');
$i = 0;
$max = 0;
while ($i++ < $max) {
    $test->create()->setName(Utils::token())->setPrice(rand(500, 15000))->save();
}
$error = null;
$dbAuth = container()->qbm('qma_auth');
// $dbAuth->create()->setLogin('gplusquellec')->setPassword(sha1('230266gp'))->save();
$session = session('qma');
$auth = $session->getAuth();
$isAuth = !is_null($auth);
if (false === $isAuth && true === context()->isPost()) {
    $login = $request->getLogin();
    $password = $request->getPassword();
    if (!is_null($login) && !is_null($password)) {
        $count = $dbAuth->where("login = {$login}")->where('password = ' . sha1($password))->count();
        if (0 < $count) {
            $isAuth = true;
            $session->setAuth($isAuth);
Ejemplo n.º 9
0
 public function __isset($key)
 {
     $check = Utils::token();
     return $check != isake($this->_data, $key, $check);
 }
Ejemplo n.º 10
0
 /**
  * Get a new, random session ID.
  *
  * @return string
  */
 protected function generateSessionId()
 {
     return sha1(uniqid('', true) . Utils::token() . microtime(true));
 }
Ejemplo n.º 11
0
 private function flush()
 {
     $item = array('insert' => Utils::token());
     $this->dbItem->push($item);
     return $this;
 }