Do not rewrite remember me cookie for each request
This commit is contained in:
@@ -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,7 +172,8 @@ class RememberMe extends Base
|
|||||||
|
|
||||||
$this->cleanup($user_id);
|
$this->cleanup($user_id);
|
||||||
|
|
||||||
$this->db
|
$this
|
||||||
|
->db
|
||||||
->table(self::TABLE)
|
->table(self::TABLE)
|
||||||
->insert(array(
|
->insert(array(
|
||||||
'user_id' => $user_id,
|
'user_id' => $user_id,
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user