From dafc3b76ea4e531adc62977184a6cb1708e46f1c Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Thu, 24 May 2018 19:52:21 -0600 Subject: [PATCH 1/5] Add message if user is kicked out of application for lack of permissions --- index.php | 7 +++++-- lang/en_us.php | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index d7803d0..7240111 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,4 @@ "The login server returned an error: {arg}", "login server user data error" => "The login server refused to provide account information. Try again or contact technical support.", "captcha error" => "There was a problem with the CAPTCHA (robot test). Try again.", + "no permission" => "You don't have permission to do that.", "home" => "Home", "more" => "More", "test" => "Test" From 66fa86e04e72ebeab3871ae0e453c32383988557 Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Thu, 24 May 2018 19:53:26 -0600 Subject: [PATCH 2/5] Change string --- index.php | 2 +- lang/en_us.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index 7240111..b61af9b 100644 --- a/index.php +++ b/index.php @@ -13,7 +13,7 @@ if ($_SESSION['loggedin'] && !isset($_GET['permissionerror'])) { } if (isset($_GET['permissionerror'])) { - $alert = lang("no permission", false); + $alert = lang("no access permission", false); } /* Authenticate user */ diff --git a/lang/en_us.php b/lang/en_us.php index 2bbe6a2..f87c6a1 100644 --- a/lang/en_us.php +++ b/lang/en_us.php @@ -28,7 +28,7 @@ define("STRINGS", [ "login server error" => "The login server returned an error: {arg}", "login server user data error" => "The login server refused to provide account information. Try again or contact technical support.", "captcha error" => "There was a problem with the CAPTCHA (robot test). Try again.", - "no permission" => "You don't have permission to do that.", + "no access permission" => "You do not have permission to access this system.", "home" => "Home", "more" => "More", "test" => "Test" From ee0c0f65e3c143b7c038ef7b08552cbe9fc829b8 Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Sat, 26 May 2018 20:51:13 -0600 Subject: [PATCH 3/5] Fix PHP variable warnings --- index.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.php b/index.php index b61af9b..59a8242 100644 --- a/index.php +++ b/index.php @@ -8,7 +8,7 @@ require_once __DIR__ . "/required.php"; require_once __DIR__ . "/lib/login.php"; // if we're logged in, we don't need to be here. -if ($_SESSION['loggedin'] && !isset($_GET['permissionerror'])) { +if (!empty($_SESSION['loggedin']) && $_SESSION['loggedin'] === true && !isset($_GET['permissionerror'])) { header('Location: app.php'); } @@ -20,7 +20,7 @@ if (isset($_GET['permissionerror'])) { $userpass_ok = false; $multiauth = false; if (checkLoginServer()) { - if ($VARS['progress'] == "1") { + if (!empty($VARS['progress']) && $VARS['progress'] == "1") { if (!CAPTCHA_ENABLED || (CAPTCHA_ENABLED && verifyCaptcheck($VARS['captcheck_session_code'], $VARS['captcheck_selected_answer'], CAPTCHA_SERVER . "/api.php"))) { $errmsg = ""; if (authenticate_user($VARS['username'], $VARS['password'], $errmsg)) { @@ -61,7 +61,7 @@ if (checkLoginServer()) { } else { $alert = lang("captcha error", false); } - } else if ($VARS['progress'] == "2") { + } else if (!empty($VARS['progress']) && $VARS['progress'] == "2") { if ($_SESSION['passok'] !== true) { // stop logins using only username and authcode sendError("Password integrity check failed!"); @@ -117,7 +117,7 @@ header("Link: ; rel=preload; as=script", false);
From 66aa3d6fdca3f0a81cfd7fbf4a8c8e8a75d5a3de Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Fri, 1 Jun 2018 13:59:31 -0600 Subject: [PATCH 4/5] Make msg alert time out with smooth visual effects --- app.php | 11 +++++++--- static/js/app.js | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 3 deletions(-) diff --git a/app.php b/app.php index 1cdd80f..ab06c6e 100644 --- a/app.php +++ b/app.php @@ -92,9 +92,14 @@ header("Link: ; rel=preload; as=script", false); echo <<
-
- - $alertmsg +
+
+ + $alertmsg +
+
+
+
diff --git a/static/js/app.js b/static/js/app.js index 2fe1a03..b306fa5 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -7,6 +7,58 @@ $(document).ready(function () { $(".alert .close").click(function (e) { $(this).parent().fadeOut("slow"); }); + + if ($("#msg-alert-box").length) { + $("#msg-alert-box .progress").css("height", "3px"); + $("#msg-alert-box .progress").css("border-radius", "0px 0px .25rem .25rem"); + $("#msg-alert-box .progress-bar").css("transition", "width 0.25s linear"); + var msginteractiontick = 0; + var fifty = 10; + var gone = 20; + + var msgticker = setInterval(function () { + if ($('#msg-alert-box .alert:hover').length) { + msginteractiontick = 0; + } else { + msginteractiontick++; + } + if (msginteractiontick > 0) { + function setBarWidth(offset) { + $("#msg-alert-timeout-bar").css("width", (msginteractiontick + offset) / gone * 100 + "%"); + } + setBarWidth(-1 + .25); + setTimeout(function () { + setBarWidth(-1 + .5); + }, 250); + setTimeout(function () { + setBarWidth(-1 + .75); + }, 500); + setTimeout(function () { + setBarWidth(0); + }, 750); + } else { + $("#msg-alert-timeout-bar").css("width", "0%"); + } + + if (msginteractiontick < fifty) { + $("#msg-alert-box .alert").css("opacity", "1"); + } + if (msginteractiontick == fifty) { + $("#msg-alert-box .alert").fadeTo(1000, 0.5); + } + if (msginteractiontick >= gone) { + $("#msg-alert-box .alert").fadeOut("slow", function () { + }); + window.clearInterval(msgticker); + } + }, 1000 * 1); + + $("#msg-alert-box").on("mouseenter", function () { + $("#msg-alert-box .alert").css("opacity", "1"); + msginteractiontick = 0; + console.log("👈😎👈 zoop"); + }); + } }); From 769d24b4b77a8f51c8ef63d14eed4255cad93783 Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Fri, 1 Jun 2018 14:04:04 -0600 Subject: [PATCH 5/5] Improve alert fadeout --- static/js/app.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/static/js/app.js b/static/js/app.js index b306fa5..445d69b 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -47,9 +47,12 @@ $(document).ready(function () { $("#msg-alert-box .alert").fadeTo(1000, 0.5); } if (msginteractiontick >= gone) { - $("#msg-alert-box .alert").fadeOut("slow", function () { - }); - window.clearInterval(msgticker); + setTimeout(function () { + if (msginteractiontick >= gone) { + $("#msg-alert-box .alert").fadeOut("slow"); + window.clearInterval(msgticker); + } + }, 1000); } }, 1000 * 1);