X-Git-Url: http://git.pjr.cc/?p=ga4php.git;a=blobdiff_plain;f=authserver%2Fauthd%2Fauthd.php;h=2474b3a8a8f942f238882940c4e354291e1653ba;hp=f4b366df897acc65f2e695a9bf3cb2d2e975c1a0;hb=1065be060c1b237c4fcdfdef6e3e2ee663d1ca33;hpb=b01c2819480261bd5c94de2bf05533c9e82a6ab2 diff --git a/authserver/authd/authd.php b/authserver/authd/authd.php index f4b366d..2474b3a 100644 --- a/authserver/authd/authd.php +++ b/authserver/authd/authd.php @@ -41,21 +41,32 @@ if($pid == -1) { echo "Call to auth user token\n"; // minimal checking, we leav it up to authenticateUser to do the real // checking - if(!isset($msg["user"])) $msg["user"] = ""; + if(!isset($msg["username"])) $msg["username"] = ""; if(!isset($msg["passcode"])) $msg["passcode"] = ""; - $username = $msg["user"]; + $username = $msg["username"]; $passcode = $msg["passcode"]; global $myga; - msg_send($cl_queue, MSG_AUTH_USER_TOKEN, $myga->authenticateUser($username, $passcode)); + $authval = $myga->authenticateUser($username, $passcode); + msg_send($cl_queue, MSG_AUTH_USER_TOKEN, $authval); break; case MSG_ADD_USER_TOKEN: echo "Call to add user token\n"; if(!isset($msg["username"])) { msg_send($cl_queue, MSG_ADD_USER_TOKEN, false); } else { - $username = $msg["username"]; + $username = $msg["username"]; + $tokentype="HOTP"; + if(isset($msg["tokentype"])) { + $tokentype="HOTP"; + } + $hexkey = ""; + if(isset($msg["hexkey"])) { + $hexkey = $msg["hexkey"]; + } global $myga; - msg_send($cl_queue, MSG_ADD_USER_TOKEN, $myga->setUser($username)); + $myga->setUser($username, $tokentype, "", $hexkey); + + msg_send($cl_queue, MSG_ADD_USER_TOKEN, $myga->createUrl($username)); } break; case MSG_DELETE_USER: @@ -145,7 +156,6 @@ if($pid == -1) { $username = $msg["username"]; $realname = $msg["realname"]; $sql = "update users set users_realname='$realname' where users_username='$username'"; - echo "sql: $sql\n"; $dbo = getDatabase(); $dbo->query($sql); @@ -167,7 +177,8 @@ if($pid == -1) { } global $myga; - msg_send($cl_queue, MSG_SET_USER_TOKEN, $myga->setUserKey($username, $passcode)); + $myga->setUserKey($username, $passcode); + msg_send($cl_queue, MSG_SET_USER_TOKEN, $myga->createUrl($username)); // TODO now set token break;