[-] BO : BugFix : #PSCFV-3120 : Multishop : employees without shop

This commit is contained in:
vChabot
2012-07-11 15:40:04 +00:00
parent 7a5ae61052
commit c724b1a4a4
2 changed files with 10 additions and 2 deletions
+9 -2
View File
@@ -141,11 +141,18 @@ class AdminLoginControllerCore extends AdminController
{
// Find employee
$this->context->employee = new Employee();
if (!$this->context->employee->getByemail($email, $passwd))
$is_employee_loaded = $this->context->employee->getByemail($email, $passwd);
$employee_associated_shop = $this->context->employee->getAssociatedShops();
if (!$is_employee_loaded)
{
$this->errors[] = Tools::displayError('Employee does not exist or password is incorrect.');
$this->context->employee->logout();
}
elseif (empty($employee_associated_shop) && !$this->context->employee->isSuperAdmin())
{
$this->errors[] = Tools::displayError('Employee does not manage any shop anymore (shop has been deleted or permissions have been removed).');
$this->context->employee->logout();
}
else
{
$this->context->employee->remote_addr = ip2long(Tools::getRemoteAddr());
@@ -203,7 +210,7 @@ class AdminLoginControllerCore extends AdminController
$pwd = Tools::passwdGen();
$employee->passwd = md5(pSQL(_COOKIE_KEY_.$pwd));
$employee->last_passwd_gen = date('Y-m-d H:i:s', time());
$params = array(
'{email}' => $employee->email,
'{lastname}' => $employee->lastname,