dolibarr  17.0.4
functions_googleoauth.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2007-2013 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2007-2009 Regis Houssin <regis.houssin@inodbox.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 
30 //include_once DOL_DOCUMENT_ROOT.'/core/class/openid.class.php';
31 
32 
42 function check_user_password_googleoauth($usertotest, $passwordtotest, $entitytotest)
43 {
44  global $_POST, $db, $conf, $langs;
45 
46  dol_syslog("functions_googleoauth::check_user_password_googleoauth usertotest=".$usertotest);
47 
48  $login = '';
49 
50  // Get identity from user and redirect browser to Google OAuth Server
51  if (GETPOSTISSET('username')) {
52  /*$openid = new SimpleOpenID();
53  $openid->SetIdentity(GETPOST('username'));
54  $protocol = ($conf->file->main_force_https ? 'https://' : 'http://');
55  $openid->SetTrustRoot($protocol . $_SERVER["HTTP_HOST"]);
56  $openid->SetRequiredFields(array('email','fullname'));
57  $_SESSION['dol_entity'] = $_POST["entity"];
58  //$openid->SetOptionalFields(array('dob','gender','postcode','country','language','timezone'));
59  if ($openid->sendDiscoveryRequestToGetXRDS())
60  {
61  $openid->SetApprovedURL($protocol . $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"]); // Send Response from OpenID server to this script
62  $openid->Redirect(); // This will redirect user to OpenID Server
63  }
64  else
65  {
66  $error = $openid->GetError();
67  return false;
68  }
69  return false;*/
70  }
71 
72 
73  return $login;
74 }
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.
check_user_password_googleoauth($usertotest, $passwordtotest, $entitytotest)
Check validity of user/password/entity If test is ko, reason must be filled into $_SESSION["dol_login...