set token types
[ga4php.git] / authserver / usercmd.php
index d19fa54..1d4db80 100644 (file)
@@ -37,15 +37,30 @@ if(!isset($argv[1])) {
        echo "\tgetusers: getusers - gets a list of users\n";
        echo "\tgetotk: getotk <username> - gets the OTKID for a key\n";
        echo "\tradauth: radauth <username> <pin> - for radius, only returns a code\n";
+       echo "\tsynctoken: synctoken <username> <tokenone> <tokentwo> - resync's a hotp token based on two token codes\n";
+       echo "\ttokentype: tokentype <username> - gets the token type for a user\n";
        return 0;       
 }
 
 switch($argv[1]) {
+       case "tokentype":
+               $msg = $myAC->getUserTokenType($argv[2]);
+               echo "token type: $msg\n";
+               break;
+       case "synctoken":
+               if($myAC->syncUserToken($argv[2], $argv[3], $argv[4])) {
+                       echo "Token synced\n";
+               } else {
+                       echo "Token not synced\n";
+               }
+               break;
        case "radauth":
                if($myAC->authUserToken($argv[2], $argv[3])==1) {
-                       return 0;
+                       syslog(LOG_WARNING, "Got good request for user, ".$argv[2]);
+                       exit(0);
                } else {
-                       return 255;
+                       syslog(LOG_WARNING, "Got bad request for user, ".$argv[2]);
+                       exit(255);
                }
                break;
        case "getotk":