From 6ccf3e839df1bbe72c3837244d2af67b8f865fae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Wed, 7 Aug 2013 13:51:18 +0200 Subject: [PATCH] // change passwd in cookie after changed it --- classes/Employee.php | 2 +- controllers/admin/AdminEmployeesController.php | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/classes/Employee.php b/classes/Employee.php index 1debb4eed..78c0dac5a 100644 --- a/classes/Employee.php +++ b/classes/Employee.php @@ -248,7 +248,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, $this->passwd) + $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')) )); } diff --git a/controllers/admin/AdminEmployeesController.php b/controllers/admin/AdminEmployeesController.php index 3c09f4cf1..d7e1a2c3e 100644 --- a/controllers/admin/AdminEmployeesController.php +++ b/controllers/admin/AdminEmployeesController.php @@ -463,6 +463,14 @@ class AdminEmployeesControllerCore extends AdminController return parent::initContent(); } + protected function afterUpdate($object) + { + $res = parent::afterUpdate($object); + // Update cookie if needed + if (Tools::getValue('id_employee') == $this->context->employee->id && Tools::getValue('passwd') && $object->passwd != $this->context->employee->passwd) + $this->context->cookie->passwd = $this->context->employee->passwd = $object->passwd; + } + public function ajaxProcessGetTabByIdProfile() { $id_profile = Tools::getValue('id_profile');