Check if the user session match an existing user
This commit is contained in:
@@ -42,6 +42,13 @@ class Authentication extends Base
|
|||||||
// If the user is already logged it's ok
|
// If the user is already logged it's ok
|
||||||
if ($this->userSession->isLogged()) {
|
if ($this->userSession->isLogged()) {
|
||||||
|
|
||||||
|
// Check if the user session match an existing user
|
||||||
|
if (! $this->user->exists($this->userSession->getId())) {
|
||||||
|
$this->backend('rememberMe')->destroy($this->userSession->getId());
|
||||||
|
$this->session->close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// We update each time the RememberMe cookie tokens
|
// We update each time the RememberMe cookie tokens
|
||||||
if ($this->backend('rememberMe')->hasCookie()) {
|
if ($this->backend('rememberMe')->hasCookie()) {
|
||||||
$this->backend('rememberMe')->refresh();
|
$this->backend('rememberMe')->refresh();
|
||||||
|
|||||||
@@ -28,6 +28,18 @@ class User extends Base
|
|||||||
*/
|
*/
|
||||||
const EVERYBODY_ID = -1;
|
const EVERYBODY_ID = -1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if the user exists
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param integer $user_id User id
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function exists($user_id)
|
||||||
|
{
|
||||||
|
return $this->db->table(self::TABLE)->eq('id', $user_id)->count() === 1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get query to fetch all users
|
* Get query to fetch all users
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user