FIX When disconnected, the search box jump to login instead of error.
This commit is contained in:
parent
583452114b
commit
7904e994a7
@ -31,8 +31,17 @@ if (! isset($usedbyinclude) || empty($usedbyinclude))
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
if (! defined('NOREDIRECTBYMAINTOLOGIN')) define('NOREDIRECTBYMAINTOLOGIN','1');
|
||||
|
||||
$res=@include '../../main.inc.php';
|
||||
if ($res == 'ERROR_NOT_LOGGED')
|
||||
{
|
||||
$langs->load("other");
|
||||
$arrayresult['jumptologin']=array('img'=>'object_generic', 'label'=>$langs->trans("JumpToLogin"), 'text'=>'<span class="fa fa-sign-in"></span> '.$langs->trans("JumpToLogin"), 'url'=>DOL_URL_ROOT.'/index.php');
|
||||
print json_encode($arrayresult);
|
||||
if (is_object($db)) $db->close();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
|
||||
|
||||
@ -18,6 +18,7 @@ NextMonthOfInvoice=Following month (number 1-12) of invoice date
|
||||
TextNextMonthOfInvoice=Following month (text) of invoice date
|
||||
ZipFileGeneratedInto=Zip file generated into <b>%s</b>.
|
||||
DocFileGeneratedInto=Doc file generated into <b>%s</b>.
|
||||
JumpToLogin=Disconnected. Go to login page...
|
||||
|
||||
YearOfInvoice=Year of invoice date
|
||||
PreviousYearOfInvoice=Previous year of invoice date
|
||||
|
||||
@ -457,9 +457,7 @@ if (! defined('NOLOGIN'))
|
||||
$passwordtotest = GETPOST('password','none',2);
|
||||
$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
|
||||
// If error, we will put error message in session under the name dol_loginmesg
|
||||
// Define if we received data to test the login.
|
||||
$goontestloop=false;
|
||||
if (isset($_SERVER["REMOTE_USER"]) && in_array('http',$authmode)) $goontestloop=true;
|
||||
if ($dolibarr_main_authentication == 'forceuser' && ! empty($dolibarr_auto_user)) $goontestloop=true;
|
||||
@ -473,6 +471,9 @@ if (! defined('NOLOGIN'))
|
||||
$langs->setDefaultLang($langcode);
|
||||
}
|
||||
|
||||
// Validation of login/pass/entity
|
||||
// If ok, the variable login will be returned
|
||||
// If error, we will put error message in session under the name dol_loginmesg
|
||||
if ($test && $goontestloop)
|
||||
{
|
||||
$login = checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmode);
|
||||
@ -531,9 +532,10 @@ if (! defined('NOLOGIN'))
|
||||
// End test login / passwords
|
||||
if (! $login || (in_array('ldap',$authmode) && empty($passwordtotest))) // With LDAP we refused empty password because some LDAP are "opened" for anonymous access so connexion is a success.
|
||||
{
|
||||
// We show login page
|
||||
// No data to test login, so we show the login page
|
||||
dol_syslog("--- Access to ".$_SERVER["PHP_SELF"]." showing the login form and exit");
|
||||
dol_loginfunction($langs,$conf,(! empty($mysoc)?$mysoc:''));
|
||||
if (defined('NOREDIRECTBYMAINTOLOGIN')) return 'ERROR_NOT_LOGGED';
|
||||
else dol_loginfunction($langs,$conf,(! empty($mysoc)?$mysoc:''));
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user