예제 #1
0
 /**
  * Send the session ID cookie to the browser.
  *
  * @param  array  $config
  * @return void
  */
 protected function cookie($config)
 {
     extract($config, EXTR_SKIP);
     $minutes = !$expire_on_close ? $lifetime : 0;
     Cookie::put($cookie, $this->session['id'], $minutes, $path, $domain, $secure);
 }
예제 #2
0
 /**
  * Test the Auth::login method.
  *
  * @group laravel
  */
 public function testLoginStoresRememberCookieWhenNeeded()
 {
     Session::$instance = new Payload($this->getMock('Laravel\\Session\\Drivers\\Driver'));
     $this->setServerVar('HTTPS', 'on');
     // Set the session vars to make sure remember cookie uses them
     Config::set('session.path', 'foo');
     Config::set('session.domain', 'bar');
     Config::set('session.secure', true);
     Auth::login(1, true);
     $this->assertTrue(isset(Cookie::$jar['laravel_auth_drivers_fluent_remember']));
     $cookie = Cookie::get('laravel_auth_drivers_fluent_remember');
     $cookie = explode('|', Crypter::decrypt($cookie));
     $this->assertEquals(1, $cookie[0]);
     $this->assertEquals('foo', Cookie::$jar['laravel_auth_drivers_fluent_remember']['path']);
     $this->assertEquals('bar', Cookie::$jar['laravel_auth_drivers_fluent_remember']['domain']);
     $this->assertTrue(Cookie::$jar['laravel_auth_drivers_fluent_remember']['secure']);
     Auth::logout();
     $this->setServerVar('HTTPS', 'off');
 }
예제 #3
0
 /**
  * Test the Cookie::forget method.
  *
  * @group laravel
  */
 public function testForgetSetsCookieWithExpiration()
 {
     Cookie::forget('bar', 'path', 'domain');
     // Shouldn't be able to test this cause while we indicate -2000 seconds
     // cookie expiration store timestamp.
     //$this->assertEquals(-2000, Cookie::$jar['bar']['expiration']);
     $this->assertEquals('path', Cookie::$jar['bar']['path']);
     $this->assertEquals('domain', Cookie::$jar['bar']['domain']);
     $this->assertFalse(Cookie::$jar['bar']['secure']);
 }
예제 #4
0
파일: session.php 프로젝트: mymizan/phreeze
 /**
  * Create the session payload and load the session.
  *
  * @return void
  */
 public static function load()
 {
     static::start(Config::get('session.driver'));
     static::$instance->load(Cookie::get(Config::get('session.cookie')));
 }
예제 #5
0
파일: cookie.php 프로젝트: jknox12/mirror
 /**
  * Delete a session from storage by a given ID.
  *
  * @param  string  $id
  * @return void
  */
 public function delete($id)
 {
     \Laravel\Cookie::forget(Cookie::payload);
 }
예제 #6
0
 /**
  * Store an authentication cookie.
  *
  * @param  string  $name
  * @param  string  $value
  * @param  int     $minutes
  * @return void
  */
 protected function cookie($name, $value, $minutes)
 {
     // When setting the default implementation of an authentication
     // cookie we'll use the same settings as the session cookie.
     // This typically makes sense as they both are sensitive.
     $config = Config::get('session');
     extract($config);
     Cookie::put($name, $value, $minutes, $path, $domain, $secure);
 }
예제 #7
0
 /**
  * Delete a session from storage by a given ID.
  *
  * @param  string  $id
  * @return void
  */
 public function delete($id)
 {
     C::forget(Cookie::payload);
 }
예제 #8
0
 /**
  * Test the Auth::recall method.
  *
  * @group laravel
  */
 public function testUserCanBeRecalledViaCookie()
 {
     Session::$instance = new Payload($this->getMock('Laravel\\Session\\Drivers\\Driver'));
     $cookie = Crypter::encrypt('1|' . Str::random(40));
     Cookie::forever('authloginstub_remember', $cookie);
     $auth = new AuthLoginStub();
     $this->assertEquals('Taylor Otwell', $auth->user()->name);
     $this->assertTrue($auth->user()->id === $_SERVER['auth.login.stub']['user']);
 }
예제 #9
0
 protected function cookie($name, $value, $minutes)
 {
     $config = Config::get('session');
     extract($config);
     Cookie::put($name, $value, $minutes, $path, $domain, $secure);
 }