diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index a756661e603..f4dd627c3b6 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -377,7 +377,7 @@ if (! defined('NOLOGIN')) $usertotest = (! empty($_COOKIE['login_dolibarr']) ? $_COOKIE['login_dolibarr'] : GETPOST("username","alpha",2)); $passwordtotest = (! empty($_COOKIE['password_dolibarr']) ? $_COOKIE['password_dolibarr'] : GETPOST('password')); - $entitytotest = (GETPOST('entity','int') ? GETPOST('entity','int') : 1); + $entitytotest = (GETPOST('entity','int') ? GETPOST('entity','int') : (!empty($conf->entity) ? $conf->entity : 1)); // Validation of login/pass/entity // If ok, the variable login will be returned