/** * Load a session from storage by a given ID. * * If no session is found for the ID, null will be returned. * * @param string $id * @return array */ public function load($id) { if (\Laravel\Cookie::has(Cookie::payload)) { $cookie = Crypter::decrypt(\Laravel\Cookie::get(Cookie::payload)); return unserialize($cookie); } }
/** * 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'); }
/** * Load a session from storage by a given ID. * * If no session is found for the ID, null will be returned. * * @param string $id * @return array */ public function load($id) { if (C::has(Cookie::payload)) { return unserialize(Crypter::decrypt(C::get(Cookie::payload))); } }
/** * Attempt to find a "remember me" cookie for the user. * * @return string|null */ protected function recall() { $cookie = Cookie::get($this->recaller()); // By default, "remember me" cookies are encrypted and contain the user // token as well as a random string. If it exists, we'll decrypt it // and return the first segment, which is the user's ID token. if (!is_null($cookie)) { return head(explode('|', Crypter::decrypt($cookie))); } }
protected function recall() { $cookie = Cookie::get($this->recaller()); if (!is_null($cookie)) { return head(explode('|', Crypter::decrypt($cookie))); } }