26if (!defined(
'NOBROWSERNOTIF')) {
27 define(
'NOBROWSERNOTIF', 1);
55 print
"Error, template page can't be called as URL";
60$size = (empty($_SERVER[
'CONTENT_LENGTH']) ? 0 : (int) $_SERVER[
'CONTENT_LENGTH']);
62 $langs->loadLangs(array(
"errors",
"install"));
63 httponly_accessforbidden(
'<center>'.$langs->trans(
"ErrorRequestTooLarge").
'.<br><a href="'.DOL_URL_ROOT.
'">'.$langs->trans(
"ClickHereToGoToApp").
'</a></center>', 413, 1);
66require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
69@phan-var-force HookManager $hookmanager
70@phan-var-force string $action
71@phan-var-force string $captcha
72@phan-var-force int<0,1> $dol_hide_leftmenu
73@phan-var-force int<0,1> $dol_hide_topmenu
74@phan-var-force int<0,1> $dol_no_mouse_hover
75@phan-var-force int<0,1> $dol_optimize_smallscreen
76@phan-var-force int<0,1> $dol_use_jmobile
77@phan-var-force string $focus_element
78@phan-var-force string $login
79@phan-var-force string $main_authentication
80@phan-var-force string $main_home
81@phan-var-force string $password
82@phan-var-force string $session_name
83@phan-var-force string $titletruedolibarrversion
84@phan-var-force string $urllogo
85@phan-var-force int<0,1> $forgetpasslink
101header(
'Cache-Control: Public, must-revalidate');
103if (
GETPOST(
'dol_hide_topmenu')) {
104 $conf->dol_hide_topmenu = 1;
106if (
GETPOST(
'dol_hide_leftmenu')) {
107 $conf->dol_hide_leftmenu = 1;
109if (
GETPOST(
'dol_optimize_smallscreen')) {
110 $conf->dol_optimize_smallscreen = 1;
112if (
GETPOST(
'dol_no_mouse_hover')) {
113 $conf->dol_no_mouse_hover = 1;
115if (
GETPOST(
'dol_use_jmobile')) {
116 $conf->dol_use_jmobile = 1;
120if (!empty(
$conf->dol_use_jmobile)) {
121 $conf->use_javascript_ajax = 1;
125if (!empty($_SERVER[
"QUERY_STRING"]) &&
dol_escape_htmltag($_SERVER[
"QUERY_STRING"])) {
126 $php_self .=
'?'.dol_escape_htmltag($_SERVER[
"QUERY_STRING"]);
128if (!preg_match(
'/mainmenu=/', $php_self)) {
129 $php_self .= (preg_match(
'/\?/', $php_self) ?
'&' :
'?').
'mainmenu=home';
131if (preg_match(
'/'.preg_quote(
'core/modules/oauth',
'/').
'/', $php_self)) {
132 $php_self = DOL_URL_ROOT.
'/index.php?mainmenu=home';
134$php_self = preg_replace(
'/(\?|&|&)action=[^&]+/',
'\1', $php_self);
135$php_self = preg_replace(
'/(\?|&|&)actionlogin=[^&]+/',
'\1', $php_self);
136$php_self = preg_replace(
'/(\?|&|&)afteroauthloginreturn=[^&]+/',
'\1', $php_self);
137$php_self = preg_replace(
'/(\?|&|&)username=[^&]*/',
'\1', $php_self);
138$php_self = preg_replace(
'/(\?|&|&)entity=\d+/',
'\1', $php_self);
139$php_self = preg_replace(
'/(\?|&|&)massaction=[^&]+/',
'\1', $php_self);
140$php_self = preg_replace(
'/(\?|&|&)token=[^&]+/',
'\1', $php_self);
141$php_self = preg_replace(
'/(&)+/',
'&', $php_self);
145 '/core/js/dst.js'.(empty(
$conf->dol_use_jmobile) ?
'' :
'?version='.urlencode(DOL_VERSION))
152 $titleofloginpage = $langs->trans(
'Login');
154$titleofloginpage .=
' @ '.$titletruedolibarrversion;
157if (!preg_match(
'/'.constant(
'DOL_APPLICATION_TITLE').
'/', $title)) {
158 $disablenofollow = 0;
161 $disablenofollow = 0;
165if (
getDolGlobalInt(
'MAIN_MODULE_OPENIDCONNECT', 0) > 0 && isset(
$conf->file->main_authentication) && preg_match(
'/openid_connect/',
$conf->file->main_authentication)) {
167 $prefix = dol_getprefix(
'');
168 if (empty($_COOKIE[
"DOL_rollback_url_$prefix"])) {
169 setcookie(
'DOL_rollback_url_' . $prefix, $_SERVER[
'REQUEST_URI'], time() + 3600,
'/');
173 if (
$conf->file->main_authentication ===
'openid_connect') {
175 if (empty(
GETPOST(
'openid_mode'))) {
177 header(
"Location: " . openid_connect_get_url(),
true, 302);
178 } elseif (!empty($_SESSION[
'dol_loginmesg'])) {
180 print
'<div class="center login_main_message"><div class="error">' .
dol_escape_htmltag($_SESSION[
'dol_loginmesg']) .
'</div></div>';
187top_htmlhead(
'', $titleofloginpage, 0, 0, $arrayofjs, array(), 1, $disablenofollow);
191$colorbackhmenu1 =
'60,70,100';
192if (!isset(
$conf->global->THEME_ELDY_TOPMENU_BACK1)) {
193 $conf->global->THEME_ELDY_TOPMENU_BACK1 = $colorbackhmenu1;
198print
"<!-- BEGIN PHP TEMPLATE LOGIN.TPL.PHP -->\n";
202 <body
class=
"body bodylogin" style=
"background-image: url('<?php echo dol_escape_htmltag(getDolGlobalString('ADD_UNSPLASH_LOGIN_BACKGROUND')); ?>'); background-repeat: no-repeat; background-position: center center; background-attachment: fixed; background-size: cover; background-color: #ffffff;">
206 <body
class=
"body bodylogin"<?php print !
getDolGlobalString(
'MAIN_LOGIN_BACKGROUND') ?
'' :
' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; background-image: url(\''.DOL_URL_ROOT.
'/viewimage.php?cache=1&noalt=1&modulepart=mycompany&file=logos/'.urlencode(
getDolGlobalString(
'MAIN_LOGIN_BACKGROUND')).
'\')
"'; ?>>
211<?php if (empty($conf->dol_use_jmobile)) { ?>
213$(document).ready(function () {
214 /* Set focus on correct field */
215 <?php if ($focus_element) {
216 ?>$('#<?php echo $focus_element; ?>').focus(); <?php
217 } ?> // Warning to use this only on visible element
222<div class="login_center center
"<?php
223if (!getDolGlobalString('ADD_UNSPLASH_LOGIN_BACKGROUND')) {
224 $backstyle = 'background: linear-gradient('.((!empty($conf->browser->layout) && $conf->browser->layout == 'phone') ? '0deg' : '4deg').', rgb(240,240,240) 52%, rgb('.$colorbackhmenu1.') 52.1%);';
225 // old style: $backstyle = 'background-image: linear-gradient(rgb('.$colorbackhmenu1.',0.3), rgb(240,240,240));';
226 $backstyle = getDolGlobalString('MAIN_LOGIN_BACKGROUND_STYLE', $backstyle);
227 print !getDolGlobalString('MAIN_LOGIN_BACKGROUND') ? ' style="background-size: cover; background-
position: center center; background-attachment: fixed; background-repeat: no-repeat;
'.$backstyle.'"' : '';
230<div class="login_vertical_align
">
233<form id="login
" name="login
" method="post
" action="<?php echo $php_self; ?>
">
235<input type="hidden
" name="token
" value="<?php echo
newToken(); ?>
" />
236<input type="hidden
" name="actionlogin
" id="actionlogin
" value="login
">
237<input type="hidden
" name="loginfunction
" id="loginfunction
" value="loginfunction
" />
238<input type="hidden
" name="backtopage
" value="<?php echo
GETPOST(
'backtopage'); ?>
" />
239<!-- Add fields to store and send local user information. This fields are filled by the core/js/dst.js -->
240<input type="hidden
" name="tz
" id="tz
" value="" />
241<input type="hidden
" name="tz_string
" id="tz_string
" value="" />
242<input type="hidden
" name="dst_observed
" id="dst_observed
" value="" />
243<input type="hidden
" name="dst_first
" id="dst_first
" value="" />
244<input type="hidden
" name="dst_second
" id="dst_second
" value="" />
245<input type="hidden
" name="screenwidth
" id="screenwidth
" value="" />
246<input type="hidden
" name="screenheight
" id="screenheight
" value="" />
247<input type="hidden
" name="dol_hide_topmenu
" id="dol_hide_topmenu
" value="<?php echo $dol_hide_topmenu; ?>
" />
248<input type="hidden
" name="dol_hide_leftmenu
" id="dol_hide_leftmenu
" value="<?php echo $dol_hide_leftmenu; ?>
" />
249<input type="hidden
" name="dol_optimize_smallscreen
" id="dol_optimize_smallscreen
" value="<?php echo $dol_optimize_smallscreen; ?>
" />
250<input type="hidden
" name="dol_no_mouse_hover
" id="dol_no_mouse_hover
" value="<?php echo $dol_no_mouse_hover; ?>
" />
251<input type="hidden
" name="dol_use_jmobile
" id="dol_use_jmobile
" value="<?php echo $dol_use_jmobile; ?>
" />
255<!-- Title with version -->
256<div class="login_table_title center
" title="<?php echo
dol_escape_htmltag($title); ?>
">
258if ($disablenofollow) {
259 echo '<a class="login_table_title
" href="https:
262if ($disablenofollow) {
270<div
class=
"login_table">
272<div
id=
"login_line1">
275<img alt=
"" src=
"<?php echo $urllogo; ?>" id=
"img_logo" />
280<div
id=
"login_right">
282<div
class=
"tagtable left centpercent" title=
"<?php echo $langs->trans("EnterLoginDetail
"); ?>">
285<?php
if (!isset(
$conf->file->main_authentication) ||
$conf->file->main_authentication !=
'googleoauth') { ?>
286<div
class=
"trinputlogin">
287<div
class=
"tagtd nowraponall center valignmiddle tdinputlogin">
289 ?><label
for=
"username" class=
"hidden"><?php echo $langs->trans(
"Login"); ?></label><?php
291<!-- <span
class=
"span-icon-user">-->
292<span
class=
"fa fa-user"></span>
293<input
type=
"text" id=
"username" maxlength=
"255" placeholder=
"<?php echo $langs->trans("Login"); ?>" name=
"username" class=
"flat input-icon-user minwidth150" value=
"<?php echo dol_escape_htmltag($login); ?>" tabindex=
"1" autofocus=
"autofocus" autocapitalize=
"off" autocomplete=
"on" spellcheck=
"false" autocorrect=
"off" />
298<div
class=
"trinputlogin">
299<div
class=
"tagtd nowraponall center valignmiddle tdinputlogin">
301 ?><label
for=
"password" class=
"hidden"><?php echo $langs->trans(
"Password"); ?></label><?php
303<!--<span
class=
"span-icon-password">-->
304<span
class=
"fa fa-key"></span>
305<input
type=
"password" id=
"password" maxlength=
"128" placeholder=
"<?php echo $langs->trans("Password
"); ?>" name=
"password" class=
"flat input-icon-password minwidth150" value=
"<?php echo dol_escape_htmltag($password); ?>" tabindex=
"2" autocomplete=
"<?php echo !getDolGlobalString('MAIN_LOGIN_ENABLE_PASSWORD_AUTOCOMPLETE') ? 'off' : 'on'; ?>" />
311if (!empty($captcha)) {
313 $php_self = preg_replace(
'/[&\?]time=(\d+)/',
'', $php_self);
314 if (preg_match(
'/\?/', $php_self)) {
315 $php_self .=
'&time='.dol_print_date(
dol_now(),
'dayhourlog');
317 $php_self .=
'?time='.dol_print_date(
dol_now(),
'dayhourlog');
321 $dirModCaptcha = array_merge(array(
'main' =>
'/core/modules/security/captcha/'), (isset(
$conf->modules_parts[
'captcha']) && is_array(
$conf->modules_parts[
'captcha'])) ?
$conf->modules_parts[
'captcha'] : array());
322 $fullpathclassfile =
'';
323 foreach ($dirModCaptcha as $dir) {
324 $fullpathclassfile =
dol_buildpath($dir.
"modCaptcha".ucfirst($captcha).
'.class.php', 0, 2);
325 if ($fullpathclassfile) {
330 if ($fullpathclassfile) {
331 include_once $fullpathclassfile;
335 $classname =
"modCaptcha".ucfirst($captcha);
336 if (class_exists($classname)) {
338 $captchaobj =
new $classname($db,
$conf, $langs,
null);
339 '@phan-var-force ModeleCaptcha $captchaobj';
341 if (is_object($captchaobj) && method_exists($captchaobj,
'getCaptchaCodeForForm')) {
342 print $captchaobj->getCaptchaCodeForForm($php_self);
344 print
'Error, the captcha handler '.get_class($captchaobj).
' does not have any method getCaptchaCodeForForm()';
347 print
'Error, the captcha handler class '.$classname.
' was not found after the include';
350 print
'Error, the captcha handler '.$captcha.
' has no class file found modCaptcha'.ucfirst($captcha);
354if (!empty($morelogincontent)) {
355 if (is_array($morelogincontent)) {
356 foreach ($morelogincontent as $format => $option) {
357 if ($format ==
'table') {
358 echo
'<!-- Option by hook -->';
363 echo
'<!-- Option by hook -->';
364 echo $morelogincontent;
372</div> <!-- end div login_right -->
374</div> <!-- end div login_line1 -->
377<div
id=
"login_line2" style=
"clear: both">
380<!-- Button Connection -->
381<?php
if (!isset(
$conf->file->main_authentication) ||
$conf->file->main_authentication !=
'googleoauth') { ?>
383<div
id=
"login-submit-wrapper">
384<input
type=
"submit" class=
"button" value=
" <?php echo $langs->trans('Connection'); ?> " tabindex=
"5" />
390if (isset(
$conf->file->main_authentication) &&
$conf->file->main_authentication ==
'googleoauth') {
391 $forgetpasslink =
'';
394if ($forgetpasslink || $helpcenterlink) {
396 if ($dol_hide_topmenu) {
397 $moreparam .= (strpos($moreparam,
'?') ===
false ?
'?' :
'&').
'dol_hide_topmenu='.$dol_hide_topmenu;
399 if ($dol_hide_leftmenu) {
400 $moreparam .= (strpos($moreparam,
'?') ===
false ?
'?' :
'&').
'dol_hide_leftmenu='.$dol_hide_leftmenu;
402 if ($dol_no_mouse_hover) {
403 $moreparam .= (strpos($moreparam,
'?') ===
false ?
'?' :
'&').
'dol_no_mouse_hover='.$dol_no_mouse_hover;
405 if ($dol_use_jmobile) {
406 $moreparam .= (strpos($moreparam,
'?') ===
false ?
'?' :
'&').
'dol_use_jmobile='.$dol_use_jmobile;
410 echo
'<div class="center" style="margin-top: 5px;">';
411 if ($forgetpasslink) {
412 $url = DOL_URL_ROOT.
'/user/passwordforgotten.php'.$moreparam;
416 echo
'<a class="alogin" href="'.dol_escape_htmltag($url).
'">';
417 echo $langs->trans(
'PasswordForgotten');
421 if ($forgetpasslink && $helpcenterlink) {
422 echo
' - ';
425 if ($helpcenterlink) {
426 echo
'<a class="alogin" href="'.dol_escape_htmltag($helpcenterlink).
'" target="_blank" rel="noopener noreferrer">';
427 echo $langs->trans(
'NeedHelpCenter');
433if (
getDolGlobalInt(
'MAIN_MODULE_OPENIDCONNECT', 0) > 0 && isset(
$conf->file->main_authentication) && preg_match(
'/openid/',
$conf->file->main_authentication)) {
435 $langs->load(
"users");
438 print
'<div class="center" style="margin-top: 20px; margin-bottom: 10px">';
439 print
'<div class="loginbuttonexternal">';
442 $url = openid_connect_get_url();
444 $url =
getDolGlobalString(
'MAIN_AUTHENTICATION_OPENID_URL').
'&state=' . openid_connect_get_state();
447 print
'<a class="alogin" href="'.$url.
'">'.$langs->trans(
"LoginUsingOpenID").
'</a>';
449 $langs->load(
"errors");
450 print
'<span class="warning">'.$langs->trans(
"ErrorOpenIDSetupNotComplete",
'MAIN_AUTHENTICATION_OPENID_URL').
'</span>';
457if (isset(
$conf->file->main_authentication) && preg_match(
'/google/',
$conf->file->main_authentication) && strpos(
$conf->browser->ua,
'DoliDroid') ===
false) {
458 $langs->load(
"users");
460 echo
'<div class="center" style="margin-top: 20px; margin-bottom: 10px">';
479 print
'<input type="hidden" name="beforeoauthloginredirect" id="beforeoauthloginredirect" value="">';
480 print
'<a class="alogin" href="#" onclick="console.log(\'Set beforeoauthloginredirect value\'); jQuery(\'#beforeoauthloginredirect\').val(\'google\'); $(this).closest(\'form\').submit(); return false;">';
481 print
'<div class="loginbuttonexternal">';
482 print
img_picto(
'',
'google',
'class="pictofixedwidth"');
483 print $langs->trans(
"LoginWith",
"Google");
491</div> <!-- end login line 2 -->
493</div> <!-- end login
table -->
502if (!empty($_SESSION[
'dol_loginmesg'])) {
503 $message = $_SESSION[
'dol_loginmesg'];
505if (!empty($message)) {
506 if (!empty(
$conf->use_javascript_ajax)) {
507 if (preg_match(
'/<!-- warning -->/', $message)) {
508 $message = str_replace(
'<!-- warning -->',
'', $message);
514 $(document).ready(function() {
515 $(".jnotify-container").addClass("jnotify-container-login");
520 <div
class=
"center login_main_message">
522 if (preg_match(
'/<!-- warning -->/', $message)) {
523 $message = str_replace(
'<!-- warning -->',
'', $message);
524 print
'<div class="warning" role="alert">';
526 print
'<div class="error" role="alert">';
537 include_once DOL_DOCUMENT_ROOT.
'/core/lib/geturl.lib.php';
538 if (substr($langs->defaultlang, 0, 2) ==
'fr') {
539 $resgetcommitstrip =
getURLContent(
"https://www.commitstrip.com/fr/feed/");
541 $resgetcommitstrip =
getURLContent(
"https://www.commitstrip.com/en/feed/");
543 if ($resgetcommitstrip && $resgetcommitstrip[
'http_code'] ==
'200') {
544 if (LIBXML_VERSION < 20900) {
548 libxml_disable_entity_loader(
true);
551 $xml = simplexml_load_string($resgetcommitstrip[
'content'],
'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NONET);
553 $little = $xml->channel->item[0]->children(
'content',
true);
554 print preg_replace(
'/width="650" height="658"/',
'', $little->encoded);
560<?php
if ($main_home) {
562 <div
class=
"center login_main_home paddingtopbottom <?php echo !getDolGlobalString('MAIN_LOGIN_BACKGROUND') ? '' : ' backgroundsemitransparent boxshadow'; ?>" style=
"max-width: 70%">
563 <?php echo $main_home; ?>
569<!-- authentication mode = <?php echo $main_authentication ?> -->
570<!-- cookie
name used
for this session = <?php echo $session_name ?> -->
571<!-- urlfrom in
this session = <?php echo isset($_SESSION[
"urlfrom"]) ? $_SESSION[
"urlfrom"] :
''; ?> -->
573<!-- Common footer is not used
for login page,
this is same than footer but inside login tpl -->
579if (!empty($morelogincontent) && is_array($morelogincontent)) {
580 foreach ($morelogincontent as $format => $option) {
581 if ($format ==
'js') {
582 echo
"\n".
'<!-- Javascript by hook -->';
586} elseif (!empty($moreloginextracontent)) {
587 echo
'<!-- Javascript by hook -->';
588 echo $moreloginextracontent;
592$parameters = array();
594$result = $hookmanager->executeHooks(
'getLoginPageExtraContent', $parameters, $dummyobject, $action);
595print $hookmanager->resPrint;
601</div><!-- end of center -->
606<!-- END PHP TEMPLATE -->
API that allows to log in with an user account.
colorStringToArray($stringcolor, $colorifnotfound=array(88, 88, 88))
Convert a string RGB value ('FFFFFF', '255,255,255') into an array RGB array(255,255,...
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
getDolUserString($key, $default='', $tmpuser=null)
Return Dolibarr user constant string value.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_htmloutput_mesg($mesgstring='', $mesgarray=array(), $style='ok', $keepembedded=0)
Print formatted messages to output (Used to show messages on html output).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
getURLContent($url, $postorget='GET', $param='', $followlocation=1, $addheaders=array(), $allowedschemes=array('http', 'https'), $localurl=0, $ssl_verifypeer=-1)
Function to get a content from an URL (use proxy if proxy defined).
treeview li table
No Email.
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs=array(), $arrayofcss=array(), $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Output html header of a page.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
$conf db name
Only used if Module[ID]Name translation string is not found.
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.