Ejemplo n.º 1
0
     $val = $myAC->getOtkID($argv[2]);
     if ($val === false) {
         echo "Failure\n";
     } else {
         echo "{$val}\n";
     }
     break;
 case "auth":
     if ($myAC->authUserToken($argv[2], $argv[3]) == 1) {
         echo "Pass!\n";
     } else {
         echo "Fail!\n";
     }
     break;
 case "add":
     $return = $myAC->addUser($argv[2]);
     if ($return) {
         echo "Created user, " . $argv[2] . "\n";
     } else {
         echo "Failed to create user, " . $argv[2] . "\n";
     }
     break;
 case "delete":
     $res = $myAC->deleteUser($argv[2]);
     if ($res) {
         echo "Deleted\n";
     } else {
         echo "Failure?\n";
     }
     break;
 case "authpass":
Ejemplo n.º 2
0
     $username = $_REQUEST["username"];
     $tokenone = $_REQUEST["tokenone"];
     $tokentwo = $_REQUEST["tokentwo"];
     $retval = $myAC->syncUserToken($username, $tokenone, $tokentwo);
     error_log("retval: {$retval}");
     if ($retval) {
         header("Location: ?message=" . urlencode("token synced"));
         exit(0);
     } else {
         header("Location: ?error=" . urlencode("token not synced"));
         exit(0);
     }
     break;
 case "recreatehotptoken":
     $username = $_REQUEST["username"];
     $myAC->addUser($username, "HOTP");
     header("Location: ?message=" . urlencode("seemed to work?"));
     break;
 case "recreatetotptoken":
     $username = $_REQUEST["username"];
     $myAC->addUser($username, "TOTP");
     header("Location: ?message=" . urlencode("seemed to work?"));
     break;
 case "deletetoken":
     $username = $_REQUEST["username"];
     $myAC->deleteUserToken($username);
     header("Location: ?message=" . urlencode("seemed to work?"));
     break;
 case "edituser":
     $username = $_REQUEST["username"];
     if ($_REQUEST["original_real"] != $_REQUEST["realname"]) {