// clean cookie after logout
This commit is contained in:
@@ -249,7 +249,7 @@ class EmployeeCore extends ObjectModel
|
||||
/* Employee is valid only if it can be load and if cookie password is the same as database one */
|
||||
Cache::store('isLoggedBack'.$this->id, (
|
||||
$this->id && Validate::isUnsignedId($this->id) && Employee::checkPassword($this->id, Context::getContext()->cookie->passwd)
|
||||
&& (!isset($this->remote_addr) || $this->remote_addr == ip2long(Tools::getRemoteAddr()) || !Configuration::get('PS_COOKIE_CHECKIP'))
|
||||
&& (!isset(Context::getContext()->cookie->remote_addr) || Context::getContext()->cookie->remote_addr == ip2long(Tools::getRemoteAddr()) || !Configuration::get('PS_COOKIE_CHECKIP'))
|
||||
));
|
||||
}
|
||||
return Cache::retrieve('isLoggedBack'.$this->id);
|
||||
@@ -261,7 +261,10 @@ class EmployeeCore extends ObjectModel
|
||||
public function logout()
|
||||
{
|
||||
if (isset(Context::getContext()->cookie))
|
||||
{
|
||||
Context::getContext()->cookie->logout();
|
||||
Context::getContext()->cookie->write();
|
||||
}
|
||||
$this->id = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1813,7 +1813,11 @@ class AdminControllerCore extends Controller
|
||||
$this->context->employee->logout();
|
||||
|
||||
if ($this->controller_name != 'AdminLogin' && (!isset($this->context->employee) || !$this->context->employee->isLoggedBack()))
|
||||
{
|
||||
if (isset($this->context->employee))
|
||||
$this->context->employee->logout();
|
||||
Tools::redirectAdmin($this->context->link->getAdminLink('AdminLogin').((!isset($_GET['logout']) && $this->controller_name != 'AdminNotFound') ? '&redirect='.$this->controller_name : ''));
|
||||
}
|
||||
|
||||
// Set current index
|
||||
$current_index = 'index.php'.(($controller = Tools::getValue('controller')) ? '?controller='.$controller : '');
|
||||
|
||||
Reference in New Issue
Block a user