public function __construct(Session $session, Cookie $cookie) { $this->session = $session; $this->cookie = $cookie; $this->secure = $session->isSecure(); $this->user = new $this->user_class(); $this->init(); }
public function __construct(Session $session, Request $request) { // Set dependencies $this->session = $session; $this->request = $request; // If a CSRF token exists if ($session->exists('csrf_token')) { // Read CSRF Token from session $this->csrf_token = $session->read('csrf_token'); } else { // Generate a CSRF Token $this->csrf_token = md5(uniqid(rand(), TRUE)); // Save token $session->write('csrf_token', $this->csrf_token); } }