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(
GETPOST(
'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'] =
GETPOST(
"entity",
'int');
54 if ($openid->sendDiscoveryRequestToGetXRDS()) {
55 $openid->SetApprovedURL($protocol.$_SERVER[
"HTTP_HOST"].$_SERVER[
"SCRIPT_NAME"]);
58 $_SESSION[
"dol_loginmesg"] = $openid->GetError();
62 } elseif ($_GET[
'openid_mode'] ==
'id_res') {
65 $openid->SetIdentity(
GETPOST(
'openid_identity'));
66 $openid_validation_result = $openid->ValidateWithServer();
67 if ($openid_validation_result ===
true) {
70 $sql =
"SELECT login, entity, datestartvalidity, dateendvalidity";
71 $sql .=
" FROM ".MAIN_DB_PREFIX.
"user";
72 $sql .=
" WHERE openid = '".$db->escape(
GETPOST(
'openid_identity')).
"'";
73 $sql .=
" AND entity IN (0,".($_SESSION[
"dol_entity"] ? ((int) $_SESSION[
"dol_entity"]) : 1).
")";
75 dol_syslog(
"functions_openid::check_user_password_openid", LOG_DEBUG);
78 $obj = $db->fetch_object(
$resql);
81 if ($obj->datestartvalidity && $db->jdate($obj->datestartvalidity) > $now) {
83 $langs->loadLangs(array(
'main',
'errors'));
84 $_SESSION[
"dol_loginmesg"] = $langs->transnoentitiesnoconv(
"ErrorLoginDateValidity");
85 return '--bad-login-validity--';
87 if ($obj->dateendvalidity && $db->jdate($obj->dateendvalidity) <
dol_get_first_hour($now)) {
89 $langs->loadLangs(array(
'main',
'errors'));
90 $_SESSION[
"dol_loginmesg"] = $langs->transnoentitiesnoconv(
"ErrorLoginDateValidity");
91 return '--bad-login-validity--';
97 } elseif ($openid->IsError() ===
true) {
99 $_SESSION[
"dol_loginmesg"] = $openid->GetError();
106 } elseif ($_GET[
'openid_mode'] ==
'cancel') {
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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 from a POST of a form...
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(isModEnabled('facture')&&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur')&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)&&$user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice')&&$user->rights->supplier_invoice->lire)) if(isModEnabled('don')&&!empty($user->rights->don->lire)) if(isModEnabled('tax')&&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture')&&isModEnabled('commande')&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.