25 include_once DOL_DOCUMENT_ROOT.
'/core/class/openid.class.php';
39 global $db, $conf, $langs;
41 dol_syslog(
"functions_openid::check_user_password_openid usertotest=".$usertotest);
48 $openid->SetIdentity($_POST[
'username']);
49 $protocol = ($conf->file->main_force_https ?
'https://' :
'http://');
50 $openid->SetTrustRoot($protocol.$_SERVER[
"HTTP_HOST"]);
51 $openid->SetRequiredFields(array(
'email',
'fullname'));
52 $_SESSION[
'dol_entity'] = $_POST[
"entity"];
54 if ($openid->sendDiscoveryRequestToGetXRDS())
56 $openid->SetApprovedURL($protocol.$_SERVER[
"HTTP_HOST"].$_SERVER[
"SCRIPT_NAME"]);
59 $_SESSION[
"dol_loginmesg"] = $openid->GetError();
63 } elseif ($_GET[
'openid_mode'] ==
'id_res') {
66 $openid->SetIdentity($_GET[
'openid_identity']);
67 $openid_validation_result = $openid->ValidateWithServer();
68 if ($openid_validation_result ===
true)
72 $sql =
"SELECT login, entity, datestartvalidity, dateendvalidity";
73 $sql .=
" FROM ".MAIN_DB_PREFIX.
"user";
74 $sql .=
" WHERE openid = '".$db->escape($_GET[
'openid_identity']).
"'";
75 $sql .=
" AND entity IN (0,".($_SESSION[
"dol_entity"] ? $_SESSION[
"dol_entity"] : 1).
")";
77 dol_syslog(
"functions_openid::check_user_password_openid", LOG_DEBUG);
81 $obj = $db->fetch_object(
$resql);
85 if ($obj->datestartvalidity && $db->jdate($obj->datestartvalidity) > $now) {
87 $langs->loadLangs(array(
'main',
'errors'));
88 $_SESSION[
"dol_loginmesg"] = $langs->trans(
"ErrorLoginDateValidity");
89 return '--bad-login-validity--';
91 if ($obj->dateendvalidity && $db->jdate($obj->dateendvalidity) <
dol_get_first_hour($now)) {
93 $langs->loadLangs(array(
'main',
'errors'));
94 $_SESSION[
"dol_loginmesg"] = $langs->trans(
"ErrorLoginDateValidity");
95 return '--bad-login-validity--';
101 } elseif ($openid->IsError() ===
true)
104 $_SESSION[
"dol_loginmesg"] = $openid->GetError();
111 } elseif ($_GET[
'openid_mode'] ==
'cancel')
dol_now($mode= 'auto')
Return date for now.
check_user_password_openid($usertotest, $passwordtotest, $entitytotest)
Check validity of user/password/entity If test is ko, reason must be filled into $_SESSION["dol_login...
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
dol_get_first_hour($date, $gm= 'tzserver')
Return GMT time for first hour of a given GMT date (it removes hours, min and second part) ...
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.