X-Git-Url: http://git.pjr.cc/?a=blobdiff_plain;f=authserver%2Fwww%2Fuser_actions.php;h=35b1f8a4daa47fc23c6a55576f671f5a29604d84;hb=4104b257d1998fe7cac9c651975e6e3cb8948705;hp=8947432b7fe3e5155cf55465b90aef6a0904e66e;hpb=1438f7f5c47f3f5c55bc8e13aa566530840e0310;p=ga4php.git diff --git a/authserver/www/user_actions.php b/authserver/www/user_actions.php index 8947432..35b1f8a 100644 --- a/authserver/www/user_actions.php +++ b/authserver/www/user_actions.php @@ -7,7 +7,7 @@ $myAC = new GAAuthClient(); $loggedin = false; session_start(); -if(isset($_SESSION["loggedin"])) if($_SESSION["loggedin"]) { +if(isset($_SESSION["user_loggedin"])) if($_SESSION["user_loggedin"]) { $loggedin = true; } else { $loggedin = false; @@ -16,6 +16,15 @@ if(isset($_SESSION["loggedin"])) if($_SESSION["loggedin"]) { if(isset($_REQUEST["action"])) { error_log("action set: ".$_REQUEST["action"]); switch($_REQUEST["action"]) { + case "actuallygettoken": + $otkid = $_REQUEST["otkid"]; + $username = $_REQUEST["username"]; + error_log("requesting otk, $otk"); + $otk_img = $myAC->getOtkPng($username,$otkid); + header("Content-type: image/png"); + echo $otk_img; + exit(0); + break; case "login": error_log("being login"); $username = $_REQUEST["username"]; @@ -23,7 +32,7 @@ if(isset($_REQUEST["action"])) { if($myAC->authUserToken($username, $token)) { - $_SESSION["loggedin"] = true; + $_SESSION["user_loggedin"] = true; $_SESSION["username"] = $username; header("Location: index.php"); } else { @@ -31,6 +40,13 @@ if(isset($_REQUEST["action"])) { header("Location: index.php?message=loginfail"); } break; + case "logout": + $_SESSION["user_loggedin"] = false; + $_SESSION["username"] = ""; + header("Location: index.php?message=".urlencode("logged out")); + exit(0); + break; + } } ?> \ No newline at end of file