Line 24:
Line 24:
Process start when you call the page you want to see. For example index.php (htdocs/index.php). But this is not this file that ask for authentication. Each Dolibarr php page include at the beginning a file called main.inc.php and this file include a file called master.inc.php.
Process start when you call the page you want to see. For example index.php (htdocs/index.php). But this is not this file that ask for authentication. Each Dolibarr php page include at the beginning a file called main.inc.php and this file include a file called master.inc.php.
So we have:
So we have:
−
<syntaxHighlight lang="php">
+
−
<mypage.php>
+
{{Template:CodeSampleForLoginProcess}}
−
<main.inc.php>
−
<master.inc.php>
−
#1#
−
</master.inc.php>
−
#2#
−
if (!isset($_SESSION["dol_login"]))
−
{
−
// Set goontestloop to true if we are coming from a post of the login page ($_POST["username"] and $_POST["actionlogin"] is defined.
−
// We may also set goontestloop to true for some other cases depending on the authentication mode (see next chapter)
−
$goontestloop = ...
−
if ($goontestloop)
−
{
−
checkLoginPassEntity(username, password, ...);
−
...
−
// if user and pass are ok, we set $login
−
$login=
−
}
−
if (! $login)
−
{
−
// We show login page
−
include_once(DOL_DOCUMENT_ROOT."/lib/security.lib.php");
−
dol_loginfunction($langs,$conf,$mysoc);
−
exit;
−
}
−
...
−
}
−
</main.inc.php>
−
#3#
−
</mypage.php>
−
</syntaxHighlight>
The #1# represents the loading of a lot of libraries that we will use later, but also initialize objects and variables containing the running PHP context (load configuration file, load language files and create an empty user not yet authenticated).
The #1# represents the loading of a lot of libraries that we will use later, but also initialize objects and variables containing the running PHP context (load configuration file, load language files and create an empty user not yet authenticated).
Line 71:
Line 41:
The file used is named '''htdocs/core/login/functions_xxx.php''' with value '''xxx''' that match the value set in '''dolibarr_main_authentication''' in config file '''conf/conf.php'''.
The file used is named '''htdocs/core/login/functions_xxx.php''' with value '''xxx''' that match the value set in '''dolibarr_main_authentication''' in config file '''conf/conf.php'''.
−
See [[Authentication,_SSO_and_SSL]] for a list of authentication mode (possible values for 'xxx' and specificities for them)
+
See [[Authentication,_SSO_and_SSL]] for a list of authentication mode (possible values for 'xxx' and specificity for them)