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); }
public function __construct() { $this->token = Session::instance('ThinSession')->getAuthToken(); if (is_null($this->token)) { $this->token = Utils::token(); Session::instance('ThinSession')->setAuthToken($this->token); } }
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(); }
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(); }
/** * Refresh the "remember me" token for the user. * * @return void */ protected function refreshRememberToken($user) { $user->setToken($token = Utils::token())->save(); }
public function has($key) { $check = Utils::token(); return $check != $this->get($key, $check); }
public static function token() { return static::input('hidden', '_token', Utils::token()); }
{ 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);
public function __isset($key) { $check = Utils::token(); return $check != isake($this->_data, $key, $check); }
/** * Get a new, random session ID. * * @return string */ protected function generateSessionId() { return sha1(uniqid('', true) . Utils::token() . microtime(true)); }
private function flush() { $item = array('insert' => Utils::token()); $this->dbItem->push($item); return $this; }