28include_once DOL_DOCUMENT_ROOT.
'/core/class/openid.class.php';
44 dol_syslog(
"functions_openid::check_user_password_openid usertotest=".$usertotest);
49 if (GETPOSTISSET(
'username')) {
51 $openid->SetIdentity(
GETPOST(
'username'));
52 $protocol = (
$conf->file->main_force_https ?
'https://' :
'http://');
53 $openid->SetTrustRoot($protocol.$_SERVER[
"HTTP_HOST"]);
54 $openid->SetRequiredFields(array(
'email',
'fullname'));
55 $_SESSION[
'dol_entity'] =
GETPOSTINT(
"entity");
57 if ($openid->sendDiscoveryRequestToGetXRDS()) {
58 $openid->SetApprovedURL($protocol.$_SERVER[
"HTTP_HOST"].$_SERVER[
"SCRIPT_NAME"]);
61 $_SESSION[
"dol_loginmesg"] = $openid->GetError();
65 } elseif (
GETPOST(
'openid_mode') ==
'id_res') {
68 $openid->SetIdentity(
GETPOST(
'openid_identity'));
69 $openid_validation_result = $openid->validateWithServer();
70 if ($openid_validation_result ===
true) {
73 $sql =
"SELECT login, entity, datestartvalidity, dateendvalidity";
74 $sql .=
" FROM ".MAIN_DB_PREFIX.
"user";
75 $sql .=
" WHERE openid = '".$db->escape(
GETPOST(
'openid_identity')).
"'";
76 $sql .=
" AND entity IN (0,".(!empty($_SESSION[
"dol_entity"]) ? ((int) $_SESSION[
"dol_entity"]) : 1).
")";
78 dol_syslog(
"functions_openid::check_user_password_openid", LOG_DEBUG);
79 $resql = $db->query($sql);
81 $obj = $db->fetch_object($resql);
87 } elseif ($openid->IsError() ===
true) {
89 $_SESSION[
"dol_loginmesg"] = $openid->GetError();
96 } elseif (
GETPOST(
'openid_mode') ==
'cancel') {
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...