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;
}
/**
* 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
*
@ -197,9 +172,10 @@ class RememberMe extends Base
$this->cleanup($user_id);
$this->db
->table(self::TABLE)
->insert(array(
$this
->db
->table(self::TABLE)
->insert(array(
'user_id' => $user_id,
'ip' => $ip,
'user_agent' => $user_agent,
@ -207,7 +183,7 @@ class RememberMe extends Base
'sequence' => $sequence,
'expiration' => $expiration,
'date_creation' => time(),
));
));
return array(
'token' => $token,

View File

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