Ejemplo n.º 1
0
 /**
  * Save a given session to storage.
  *
  * @param  array  $session
  * @param  array  $config
  * @param  bool   $exists
  * @return void
  */
 public function save($session, $config, $exists)
 {
     extract($config, EXTR_SKIP);
     $payload = Crypter::encrypt(serialize($session));
     $success = \Laravel\Cookie::put(Cookie::payload, $payload, $lifetime, $path, $domain);
 }
Ejemplo n.º 2
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']);
 }
Ejemplo n.º 3
0
 /**
  * Store a user's token in a long-lived cookie.
  *
  * @param  string  $token
  * @return void
  */
 protected function remember($token)
 {
     $token = Crypter::encrypt($token . '|' . Str::random(40));
     $this->cookie($this->recaller(), $token, Cookie::forever);
 }