Fix minor

This commit is contained in:
Laurent Destailleur
2018-01-14 20:11:38 +01:00
parent cc5dcde9e1
commit 90fc086814
5 changed files with 25 additions and 11 deletions

View File

@@ -80,7 +80,8 @@ function checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmod
$newdir=dol_osencode($dir); $newdir=dol_osencode($dir);
// Check if file found (do not use dol_is_file to avoid loading files.lib.php) // 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; $result=false;
@@ -89,7 +90,7 @@ function checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmod
{ {
// Call function to check user/password // Call function to check user/password
$function='check_user_password_'.$mode; $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 if ($login) // Login is successfull
{ {
$test=false; // To stop once at first login success $test=false; // To stop once at first login success

View File

@@ -33,9 +33,12 @@
*/ */
function check_user_password_empty($usertotest,$passwordtotest,$entitytotest) function check_user_password_empty($usertotest,$passwordtotest,$entitytotest)
{ {
global $langs;
dol_syslog("functions_empty::check_user_password_empty usertotest=".$usertotest); dol_syslog("functions_empty::check_user_password_empty usertotest=".$usertotest);
$login=''; $login='';
$_SESSION["dol_loginmesg"]=$langs->trans("FailedToLogin");
return $login; return $login;
} }

View File

@@ -244,9 +244,9 @@ if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file
</form> </form>
<?php
// Show error message if defined
<?php if (! empty($_SESSION['dol_loginmesg'])) if (! empty($_SESSION['dol_loginmesg']))
{ {
?> ?>
<div class="center login_main_message"><div class="error"> <div class="center login_main_message"><div class="error">

View File

@@ -210,8 +210,11 @@ if (! empty($_POST["DOL_AUTOSET_COOKIE"]))
if (empty($cookievalue)) unset($_COOKIE[$cookiename]); if (empty($cookievalue)) unset($_COOKIE[$cookiename]);
} }
// Init session. Name of session is specific to Dolibarr instance. // 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(''); $prefix=dol_getprefix('');
$sessionname='DOLSESSID_'.$prefix; $sessionname='DOLSESSID_'.$prefix;
$sessiontimeout='DOLSESSTIMEOUT_'.$prefix; $sessiontimeout='DOLSESSTIMEOUT_'.$prefix;
if (! empty($_COOKIE[$sessiontimeout])) ini_set('session.gc_maxlifetime',$_COOKIE[$sessiontimeout]); if (! empty($_COOKIE[$sessiontimeout])) ini_set('session.gc_maxlifetime',$_COOKIE[$sessiontimeout]);
@@ -375,12 +378,19 @@ $login='';
if (! defined('NOLOGIN')) if (! defined('NOLOGIN'))
{ {
// $authmode lists the different means of identification to be tested in order of preference. // $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 (defined('MAIN_AUTHENTICATION_MODE'))
if (empty($dolibarr_main_authentication)) $dolibarr_main_authentication='http,dolibarr'; {
// Authentication mode: forceuser $dolibarr_main_authentication = constant('MAIN_AUTHENTICATION_MODE');
if ($dolibarr_main_authentication == 'forceuser' && empty($dolibarr_auto_user)) $dolibarr_auto_user='auto'; }
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 // Set authmode
$authmode=explode(',',$dolibarr_main_authentication); $authmode=explode(',',$dolibarr_main_authentication);

View File

@@ -86,7 +86,7 @@ class modMyModule extends DolibarrModules
// for specific css file (eg: /mymodule/css/mymodule.css.php) // for specific css file (eg: /mymodule/css/mymodule.css.php)
$this->module_parts = array( $this->module_parts = array(
'triggers' => 1, // Set this to 1 if module has its own trigger directory (core/triggers) '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) '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) '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) 'theme' => 0, // Set this to 1 if module has its own theme directory (theme)