diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php
index a7b71157080..a61d103c16f 100644
--- a/htdocs/core/lib/security2.lib.php
+++ b/htdocs/core/lib/security2.lib.php
@@ -80,7 +80,8 @@ function checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmod
$newdir=dol_osencode($dir);
// Check if file found (do not use dol_is_file to avoid loading files.lib.php)
- if (is_file($newdir.'/'.$authfile)) $fullauthfile=$newdir.'/'.$authfile;
+ $tmpnewauthfile = $newdir.(preg_match('/\/$/',$newdir)?'':'/').$authfile;
+ if (is_file($tmpnewauthfile)) $fullauthfile=$tmpnewauthfile;
}
$result=false;
@@ -89,7 +90,7 @@ function checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmod
{
// Call function to check user/password
$function='check_user_password_'.$mode;
- $login=call_user_func($function,$usertotest,$passwordtotest,$entitytotest);
+ $login=call_user_func($function, $usertotest, $passwordtotest, $entitytotest);
if ($login) // Login is successfull
{
$test=false; // To stop once at first login success
diff --git a/htdocs/core/login/functions_empty.php b/htdocs/core/login/functions_empty.php
index e4379ee2c3a..b2ce4a3c533 100644
--- a/htdocs/core/login/functions_empty.php
+++ b/htdocs/core/login/functions_empty.php
@@ -33,9 +33,12 @@
*/
function check_user_password_empty($usertotest,$passwordtotest,$entitytotest)
{
+ global $langs;
+
dol_syslog("functions_empty::check_user_password_empty usertotest=".$usertotest);
$login='';
+ $_SESSION["dol_loginmesg"]=$langs->trans("FailedToLogin");
return $login;
}
diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php
index 013271336cb..49a65d01c5c 100644
--- a/htdocs/core/tpl/login.tpl.php
+++ b/htdocs/core/tpl/login.tpl.php
@@ -244,9 +244,9 @@ if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file
-
-
-
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index ab4db856975..2fc8c7ba6ee 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -210,8 +210,11 @@ if (! empty($_POST["DOL_AUTOSET_COOKIE"]))
if (empty($cookievalue)) unset($_COOKIE[$cookiename]);
}
+
// Init session. Name of session is specific to Dolibarr instance.
+// Note: the function dol_getprefix have been redefined to manage another area to protect with a different cookie.
$prefix=dol_getprefix('');
+
$sessionname='DOLSESSID_'.$prefix;
$sessiontimeout='DOLSESSTIMEOUT_'.$prefix;
if (! empty($_COOKIE[$sessiontimeout])) ini_set('session.gc_maxlifetime',$_COOKIE[$sessiontimeout]);
@@ -375,12 +378,19 @@ $login='';
if (! defined('NOLOGIN'))
{
// $authmode lists the different means of identification to be tested in order of preference.
- // Example: 'http', 'dolibarr', 'ldap', 'http,forceuser'
+ // Example: 'http', 'dolibarr', 'ldap', 'http,forceuser', '...'
- // Authentication mode
- if (empty($dolibarr_main_authentication)) $dolibarr_main_authentication='http,dolibarr';
- // Authentication mode: forceuser
- if ($dolibarr_main_authentication == 'forceuser' && empty($dolibarr_auto_user)) $dolibarr_auto_user='auto';
+ if (defined('MAIN_AUTHENTICATION_MODE'))
+ {
+ $dolibarr_main_authentication = constant('MAIN_AUTHENTICATION_MODE');
+ }
+ else
+ {
+ // Authentication mode
+ if (empty($dolibarr_main_authentication)) $dolibarr_main_authentication='http,dolibarr';
+ // Authentication mode: forceuser
+ if ($dolibarr_main_authentication == 'forceuser' && empty($dolibarr_auto_user)) $dolibarr_auto_user='auto';
+ }
// Set authmode
$authmode=explode(',',$dolibarr_main_authentication);
diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
index bedc908415f..8a266ba20cf 100644
--- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
+++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
@@ -86,7 +86,7 @@ class modMyModule extends DolibarrModules
// for specific css file (eg: /mymodule/css/mymodule.css.php)
$this->module_parts = array(
'triggers' => 1, // Set this to 1 if module has its own trigger directory (core/triggers)
- 'login' => 0, // Set this to 1 if module has its own login method directory (core/login)
+ 'login' => 0, // Set this to 1 if module has its own login method file (core/login)
'substitutions' => 1, // Set this to 1 if module has its own substitution function file (core/substitutions)
'menus' => 0, // Set this to 1 if module has its own menus handler directory (core/menus)
'theme' => 0, // Set this to 1 if module has its own theme directory (theme)