Merge branch 'develop' of ssh://git@github.com/Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
4f5e88adb6
@ -162,7 +162,15 @@ function checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmod
|
|||||||
function dol_loginfunction($langs,$conf,$mysoc)
|
function dol_loginfunction($langs,$conf,$mysoc)
|
||||||
{
|
{
|
||||||
global $dolibarr_main_demo,$db;
|
global $dolibarr_main_demo,$db;
|
||||||
global $smartphone,$mc;
|
global $smartphone,$hookmanager;
|
||||||
|
|
||||||
|
// Instantiate hooks of thirdparty module only if not already define
|
||||||
|
if (! is_object($hookmanager))
|
||||||
|
{
|
||||||
|
include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php');
|
||||||
|
$hookmanager=new HookManager($db);
|
||||||
|
}
|
||||||
|
$hookmanager->initHooks(array('mainloginpage'));
|
||||||
|
|
||||||
$langcode=(GETPOST('lang')?((is_object($langs)&&$langs->defaultlang)?$langs->defaultlang:'auto'):GETPOST('lang'));
|
$langcode=(GETPOST('lang')?((is_object($langs)&&$langs->defaultlang)?$langs->defaultlang:'auto'):GETPOST('lang'));
|
||||||
$langs->setDefaultLang($langcode);
|
$langs->setDefaultLang($langcode);
|
||||||
@ -229,37 +237,18 @@ function dol_loginfunction($langs,$conf,$mysoc)
|
|||||||
$demologin=$tab[0];
|
$demologin=$tab[0];
|
||||||
$demopassword=$tab[1];
|
$demopassword=$tab[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Entity cookie
|
// Execute hook getLoginPageOptions
|
||||||
if (! empty($conf->multicompany->enabled))
|
// Should be an array with differents options in $hookmanager->resArray
|
||||||
{
|
$parameters=array('entity' => $_POST['entity']);
|
||||||
$lastuser = '';
|
$hookmanager->executeHooks('getLoginPageOptions',$parameters); // Note that $action and $object may have been modified by some hooks
|
||||||
$lastentity = $_POST['entity'];
|
|
||||||
|
|
||||||
if (! empty($conf->global->MULTICOMPANY_COOKIE_ENABLED))
|
|
||||||
{
|
|
||||||
$prefix=dol_getprefix();
|
|
||||||
$entityCookieName = 'DOLENTITYID_'.$prefix;
|
|
||||||
if (isset($_COOKIE[$entityCookieName]))
|
|
||||||
{
|
|
||||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/cookie.class.php");
|
|
||||||
|
|
||||||
$cryptkey = (! empty($conf->file->cookie_cryptkey) ? $conf->file->cookie_cryptkey : '' );
|
|
||||||
|
|
||||||
$entityCookie = new DolCookie($cryptkey);
|
|
||||||
$cookieValue = $entityCookie->_getCookie($entityCookieName);
|
|
||||||
list($lastuser, $lastentity) = explode('|', $cookieValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Login
|
// Login
|
||||||
$login = (!empty($lastuser)?$lastuser:(GETPOST("username","alpha",2)?GETPOST("username","alpha",2):$demologin));
|
$login = (! empty($hookmanager->resArray['username']) ? $hookmanager->resArray['username'] : (GETPOST("username","alpha",2) ? GETPOST("username","alpha",2) : $demologin));
|
||||||
$password = $demopassword;
|
$password = $demopassword;
|
||||||
|
|
||||||
// Show logo (search in order: small company logo, large company logo, theme logo, common logo)
|
// Show logo (search in order: small company logo, large company logo, theme logo, common logo)
|
||||||
$width=0;
|
$width=0;
|
||||||
$rowspan=2;
|
|
||||||
$urllogo=DOL_URL_ROOT.'/theme/login_logo.png';
|
$urllogo=DOL_URL_ROOT.'/theme/login_logo.png';
|
||||||
|
|
||||||
if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
|
if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
|
||||||
@ -281,14 +270,6 @@ function dol_loginfunction($langs,$conf,$mysoc)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Entity field
|
|
||||||
$select_entity='';
|
|
||||||
if (! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_HIDE_LOGIN_COMBOBOX))
|
|
||||||
{
|
|
||||||
$rowspan++;
|
|
||||||
$select_entity = $mc->select_entities($lastentity, 'entity', ' tabindex="3"', 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Security graphical code
|
// Security graphical code
|
||||||
$captcha=0;
|
$captcha=0;
|
||||||
$captcha_refresh='';
|
$captcha_refresh='';
|
||||||
|
|||||||
@ -234,14 +234,18 @@ jQuery(document).ready(function () {
|
|||||||
<input id="password" name="password" class="flat" type="password" size="15" maxlength="30" value="<?php echo $password; ?>" tabindex="2" />
|
<input id="password" name="password" class="flat" type="password" size="15" maxlength="30" value="<?php echo $password; ?>" tabindex="2" />
|
||||||
</td></tr>
|
</td></tr>
|
||||||
|
|
||||||
<?php if ($select_entity) { ?>
|
<?php
|
||||||
<tr><td valign="top" nowrap="nowrap"> <strong><?php echo $langs->trans('Entity'); ?></strong> </td>
|
if (! empty($hookmanager->resArray['options'])) {
|
||||||
<td valign="top" nowrap="nowrap">
|
foreach ($hookmanager->resArray['options'] as $option)
|
||||||
<?php echo $select_entity; ?>
|
{
|
||||||
</td></tr>
|
echo '<!-- Option by hook -->';
|
||||||
<?php } ?>
|
echo $option;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
<?php if ($captcha) { ?>
|
<?php if ($captcha) { ?>
|
||||||
|
<!-- Captcha -->
|
||||||
<tr><td valign="middle" nowrap="nowrap"> <b><?php echo $langs->trans('SecurityCode'); ?></b></td>
|
<tr><td valign="middle" nowrap="nowrap"> <b><?php echo $langs->trans('SecurityCode'); ?></b></td>
|
||||||
<td valign="top" nowrap="nowrap" align="left" class="none">
|
<td valign="top" nowrap="nowrap" align="left" class="none">
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user