Do not rewrite remember me cookie for each request

This commit is contained in:
Frederic Guillot
2015-07-05 10:40:41 -04:00
parent e7b967d743
commit 45774afafc
2 changed files with 5 additions and 34 deletions

View File

@@ -118,31 +118,6 @@ class RememberMe extends Base
return false; return false;
} }
/**
* Update the database and the cookie with a new sequence
*
* @access public
*/
public function refresh()
{
$credentials = $this->readCookie();
if ($credentials !== false) {
$record = $this->find($credentials['token'], $credentials['sequence']);
if ($record) {
// Update the sequence
$this->writeCookie(
$record['token'],
$this->update($record['token']),
$record['expiration']
);
}
}
}
/** /**
* Remove a session record * Remove a session record
* *
@@ -197,9 +172,10 @@ class RememberMe extends Base
$this->cleanup($user_id); $this->cleanup($user_id);
$this->db $this
->table(self::TABLE) ->db
->insert(array( ->table(self::TABLE)
->insert(array(
'user_id' => $user_id, 'user_id' => $user_id,
'ip' => $ip, 'ip' => $ip,
'user_agent' => $user_agent, 'user_agent' => $user_agent,
@@ -207,7 +183,7 @@ class RememberMe extends Base
'sequence' => $sequence, 'sequence' => $sequence,
'expiration' => $expiration, 'expiration' => $expiration,
'date_creation' => time(), 'date_creation' => time(),
)); ));
return array( return array(
'token' => $token, 'token' => $token,

View File

@@ -49,11 +49,6 @@ class Authentication extends Base
return false; return false;
} }
// We update each time the RememberMe cookie tokens
if ($this->backend('rememberMe')->hasCookie()) {
$this->backend('rememberMe')->refresh();
}
return true; return true;
} }