|
|
@ -45,7 +45,7 @@ function checkLoginServer() {
|
|
|
|
* @param string $password
|
|
|
|
* @param string $password
|
|
|
|
* @return boolean True if OK, else false
|
|
|
|
* @return boolean True if OK, else false
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function authenticate_user($username, $password) {
|
|
|
|
function authenticate_user($username, $password, &$errmsg) {
|
|
|
|
$client = new GuzzleHttp\Client();
|
|
|
|
$client = new GuzzleHttp\Client();
|
|
|
|
|
|
|
|
|
|
|
|
$response = $client
|
|
|
|
$response = $client
|
|
|
@ -66,6 +66,7 @@ function authenticate_user($username, $password) {
|
|
|
|
if ($resp['status'] == "OK") {
|
|
|
|
if ($resp['status'] == "OK") {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$errmsg = $resp['msg'];
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -98,6 +99,34 @@ function user_exists($username) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Check if a UID exists.
|
|
|
|
|
|
|
|
* @param String $uid
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
function uid_exists($uid) {
|
|
|
|
|
|
|
|
$client = new GuzzleHttp\Client();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$response = $client
|
|
|
|
|
|
|
|
->request('POST', PORTAL_API, [
|
|
|
|
|
|
|
|
'form_params' => [
|
|
|
|
|
|
|
|
'key' => PORTAL_KEY,
|
|
|
|
|
|
|
|
'action' => "userexists",
|
|
|
|
|
|
|
|
'uid' => $uid
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($response->getStatusCode() > 299) {
|
|
|
|
|
|
|
|
sendError("Login server error: " . $response->getBody());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$resp = json_decode($response->getBody(), TRUE);
|
|
|
|
|
|
|
|
if ($resp['status'] == "OK" && $resp['exists'] === true) {
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Get the account status: NORMAL, TERMINATED, LOCKED_OR_DISABLED,
|
|
|
|
* Get the account status: NORMAL, TERMINATED, LOCKED_OR_DISABLED,
|
|
|
|
* CHANGE_PASSWORD, or ALERT_ON_ACCESS
|
|
|
|
* CHANGE_PASSWORD, or ALERT_ON_ACCESS
|
|
|
|