From e9bf9fd222a22565ebc13e1d903b006563f86204 Mon Sep 17 00:00:00 2001 From: Elizabeth Cray Date: Sat, 7 May 2022 08:02:58 +0000 Subject: [PATCH] Popups and Niceties --- auth/index.php | 34 +++++++++++++---- auth/setKey.php | 70 +++++++++++++++++++++++++++++++++++ favicon.ico | Bin 0 -> 1676 bytes index.html | 8 ++-- index.js | 95 +++++++++++++++++++++++++++++++++++++++++------- style.css | 4 ++ 6 files changed, 185 insertions(+), 26 deletions(-) create mode 100644 auth/setKey.php create mode 100644 favicon.ico diff --git a/auth/index.php b/auth/index.php index 2117b1a..b51e970 100644 --- a/auth/index.php +++ b/auth/index.php @@ -24,19 +24,20 @@ if (isset($_REQUEST["act"])){ - - - + + + +
@@ -52,6 +53,7 @@ if (isset($_REQUEST["act"])){ $AuthToken = ""; $UserName = ""; $ErrorDesc = ""; + $UserId = ""; $request = curl_init(); curl_setopt($request, CURLOPT_POST, 1); curl_setopt($request, CURLOPT_URL, "https://hackers.town/oauth/token"); @@ -82,6 +84,7 @@ if (isset($_REQUEST["act"])){ // Congrats! $AuthToken = $Auth->access_token; $UserName = $User->display_name; + $UserId = $User->id; }else{ // invalid auth $AuthToken = "BadUser"; @@ -89,8 +92,23 @@ if (isset($_REQUEST["act"])){ } }else{ // invalid auth - $AuthToken = "BadOauth"; - $ErrorDesc = "Invalid OAuth"; + if(isset($_COOKIE["oa_retries"])){ + $retries = $_COOKIE["oa_retries"]; + if($retries >= 3){ + $AuthToken = "BadUser"; + $ErrorDesc = "Invalid OAuth"; + setcookie("oa_retries", 0, time()+3600); + }else{ + $retries++; + setcookie("oa_retries", $retries, time()+3600); + $AuthToken = "BadOauthRetry"; + $ErrorDesc = "Invalid OAuth Retry"; + } + }else{ + $AuthToken = "BadOauth"; + $ErrorDesc = "Invalid OAuth Retry"; + setcookie("oa_retries", 1, time()+3600); + } } // revoke token after usage @@ -106,7 +124,7 @@ if (isset($_REQUEST["act"])){ try again -
+
> - + + +