示例#1
0
 public function testSessionCsrfToken()
 {
     Config::set('session.default', 'native');
     Session::register($this->di);
     Session::start();
     $this->assertNotEmpty($csrf = Session::generateCsrfToken(), 'Unable to generate CSRF token');
     $this->assertEquals($csrf, Session::getCsrfToken(), 'Unable to check CSRF token');
     Session::clear();
     $this->assertNotEmpty($newCsrf = Session::getCsrfToken(), 'Unable to regenerate CSRF token');
     $this->assertNotEquals($csrf, $newCsrf, 'Unable to regenerate unique CSRF token');
     Session::end();
 }
示例#2
0
 public function logout()
 {
     if ($this->getUser() && method_exists($this->user, 'removeRememberToken')) {
         $this->user->removeRememberToken();
     }
     Cookies::set($cookieName = $this->options['remember_login']['cookie_key'], '', null, null, null, null, true);
     Cookies::get($cookieName)->useEncryption(false);
     $this->user = null;
     Session::clear();
     return $this;
 }