mirror of
https://github.com/tuxis-ie/nsedit.git
synced 2025-06-06 00:37:25 +03:00
Allow authentication via Wefact
This commit is contained in:
parent
6b0a4d8595
commit
bc5a4964ec
4 changed files with 76 additions and 18 deletions
|
@ -1,6 +1,10 @@
|
|||
<?php
|
||||
|
||||
include_once('config.inc.php');
|
||||
include_once('misc.inc.php');
|
||||
|
||||
/* This class is written by Wefact. See https://www.wefact.nl/wefact-hosting/apiv2/
|
||||
*/
|
||||
|
||||
class WeFactAPI
|
||||
{
|
||||
|
@ -52,16 +56,26 @@ class WeFactAPI
|
|||
|
||||
function do_wefact_auth($u, $p) {
|
||||
$wefact = new WeFactApi();
|
||||
$r = $wefact->sendRequest('debtor', 'checklogin', array(
|
||||
'Username' => $u,
|
||||
'Password' => $p
|
||||
));
|
||||
$r = $wefact->sendRequest('debtor', 'show', array(
|
||||
'DebtorCode' => $u));
|
||||
|
||||
if (isset($r['status']) && $r['status'] == 'success') {
|
||||
return TRUE;
|
||||
}
|
||||
$r = $wefact->sendRequest('debtor', 'checklogin', array(
|
||||
'Username' => $u,
|
||||
'Password' => $p
|
||||
));
|
||||
|
||||
return FALSE;
|
||||
if (isset($r['status']) && $r['status'] == 'success') {
|
||||
if (get_user_info($u) == FALSE) {
|
||||
add_user($u);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue