Commit b7b5451a authored by Taylor Otwell's avatar Taylor Otwell

refactoring session handling.

parent c9beefaa
...@@ -32,6 +32,4 @@ abstract class Facade { ...@@ -32,6 +32,4 @@ abstract class Facade {
} }
class Crypter extends Facade { public static $resolve = 'laravel.crypter'; }
class Hasher extends Facade { public static $resolve = 'laravel.hasher'; }
class Session extends Facade { public static $resolve = 'laravel.session'; } class Session extends Facade { public static $resolve = 'laravel.session'; }
\ No newline at end of file
...@@ -21,13 +21,6 @@ class Manager { ...@@ -21,13 +21,6 @@ class Manager {
*/ */
private $transporter; private $transporter;
/**
* The session payload instance.
*
* @var Payload
*/
private $payload;
/** /**
* Indicates if the session exists in persistent storage. * Indicates if the session exists in persistent storage.
* *
...@@ -61,7 +54,7 @@ class Manager { ...@@ -61,7 +54,7 @@ class Manager {
// If the session is expired, a new session will be generated and all of the data from // If the session is expired, a new session will be generated and all of the data from
// the previous session will be lost. The new session will be assigned a random, long // the previous session will be lost. The new session will be assigned a random, long
// string ID to uniquely identify it among the application's current users. // string ID to uniquely identify it among the application's current users.
if (is_null($session) or $this->expired($session, $config)) if (is_null($session) or (time() - $session['last_activity']) > ($config['lifetime'] * 60))
{ {
$this->exists = false; $this->exists = false;
...@@ -82,19 +75,6 @@ class Manager { ...@@ -82,19 +75,6 @@ class Manager {
return $payload; return $payload;
} }
/**
* Deteremine if the session is expired based on the last activity timestamp
* and the session lifetime set in the configuration file.
*
* @param array $session
* @param array $config
* @return bool
*/
private function expired($session, $config)
{
return (time() - $session['last_activity']) > ($config['lifetime'] * 60);
}
/** /**
* Close the session handling for the request. * Close the session handling for the request.
* *
...@@ -107,10 +87,7 @@ class Manager { ...@@ -107,10 +87,7 @@ class Manager {
{ {
// If the session ID has been regenerated, we will need to inform the session driver // If the session ID has been regenerated, we will need to inform the session driver
// that the session will need to be persisted to the data store as a new session. // that the session will need to be persisted to the data store as a new session.
if ($payload->regenerated) if ($payload->regenerated) $this->exists = false;
{
$this->exists = false;
}
foreach ($flash as $key => $value) foreach ($flash as $key => $value)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment