Skylar Ittner 6 years ago
commit 6cf831eaf3

@ -92,9 +92,14 @@ header("Link: <static/js/bootstrap.min.js>; rel=preload; as=script", false);
echo <<<END echo <<<END
<div class="row justify-content-center" id="msg-alert-box"> <div class="row justify-content-center" id="msg-alert-box">
<div class="col-11 col-sm-6 col-md-5 col-lg-4 col-xl-4"> <div class="col-11 col-sm-6 col-md-5 col-lg-4 col-xl-4">
<div class="alert alert-dismissible alert-$alerttype"> <div class="alert alert-dismissible alert-$alerttype mt-2 p-0 border-0 shadow">
<button type="button" class="close">&times;</button> <div class="p-2 pl-3">
<i class="fas fa-$alerticon"></i> $alertmsg <button type="button" class="close">&times;</button>
<i class="fas fa-$alerticon"></i> $alertmsg
</div>
<div class="progress">
<div class="progress-bar bg-$alerttype w-0" id="msg-alert-timeout-bar"></div>
</div>
</div> </div>
</div> </div>
</div> </div>

@ -1,5 +1,4 @@
<?php <?php
/* This Source Code Form is subject to the terms of the Mozilla Public /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@ -9,15 +8,19 @@ require_once __DIR__ . "/required.php";
require_once __DIR__ . "/lib/login.php"; require_once __DIR__ . "/lib/login.php";
// if we're logged in, we don't need to be here. // if we're logged in, we don't need to be here.
if ($_SESSION['loggedin']) { if (!empty($_SESSION['loggedin']) && $_SESSION['loggedin'] === true && !isset($_GET['permissionerror'])) {
header('Location: app.php'); header('Location: app.php');
} }
if (isset($_GET['permissionerror'])) {
$alert = lang("no access permission", false);
}
/* Authenticate user */ /* Authenticate user */
$userpass_ok = false; $userpass_ok = false;
$multiauth = false; $multiauth = false;
if (checkLoginServer()) { 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"))) { if (!CAPTCHA_ENABLED || (CAPTCHA_ENABLED && verifyCaptcheck($VARS['captcheck_session_code'], $VARS['captcheck_selected_answer'], CAPTCHA_SERVER . "/api.php"))) {
$errmsg = ""; $errmsg = "";
if (authenticate_user($VARS['username'], $VARS['password'], $errmsg)) { if (authenticate_user($VARS['username'], $VARS['password'], $errmsg)) {
@ -58,7 +61,7 @@ if (checkLoginServer()) {
} else { } else {
$alert = lang("captcha error", false); $alert = lang("captcha error", false);
} }
} else if ($VARS['progress'] == "2") { } else if (!empty($VARS['progress']) && $VARS['progress'] == "2") {
if ($_SESSION['passok'] !== true) { if ($_SESSION['passok'] !== true) {
// stop logins using only username and authcode // stop logins using only username and authcode
sendError("Password integrity check failed!"); sendError("Password integrity check failed!");
@ -114,7 +117,7 @@ header("Link: <static/js/bootstrap.min.js>; rel=preload; as=script", false);
<h5 class="card-title"><?php lang("sign in"); ?></h5> <h5 class="card-title"><?php lang("sign in"); ?></h5>
<form action="" method="POST"> <form action="" method="POST">
<?php <?php
if (!is_empty($alert)) { if (!empty($alert)) {
?> ?>
<div class="alert alert-danger"> <div class="alert alert-danger">
<i class="fa fa-fw fa-exclamation-triangle"></i> <?php echo $alert; ?> <i class="fa fa-fw fa-exclamation-triangle"></i> <?php echo $alert; ?>

@ -30,6 +30,7 @@ define("STRINGS", [
"login server error" => "The login server returned an error: {arg}", "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.", "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.", "captcha error" => "There was a problem with the CAPTCHA (robot test). Try again.",
"no access permission" => "You do not have permission to access this system.",
"home" => "Home", "home" => "Home",
"more" => "More", "more" => "More",
"punch in out" => "Punch In/Out", "punch in out" => "Punch In/Out",

@ -8,13 +8,59 @@ $(document).ready(function () {
$(this).parent().fadeOut("slow"); $(this).parent().fadeOut("slow");
}); });
try { if ($("#msg-alert-box").length) {
window.history.replaceState("", "", getniceurl()); $("#msg-alert-box .progress").css("height", "3px");
if (window.location.hash) { $("#msg-alert-box .progress").css("border-radius", "0px 0px .25rem .25rem");
document.getElementById(window.location.hash.replace("#", "")).scrollIntoView(); $("#msg-alert-box .progress-bar").css("transition", "width 0.25s linear");
} var msginteractiontick = 0;
} catch (ex) { 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) {
setTimeout(function () {
if (msginteractiontick >= gone) {
$("#msg-alert-box .alert").fadeOut("slow");
window.clearInterval(msgticker);
}
}, 1000);
}
}, 1000 * 1);
$("#msg-alert-box").on("mouseenter", function () {
$("#msg-alert-box .alert").css("opacity", "1");
msginteractiontick = 0;
console.log("👈😎👈 zoop");
});
} }
}); });
@ -32,4 +78,4 @@ try {
window.history.replaceState("", "", getniceurl()); window.history.replaceState("", "", getniceurl());
} catch (ex) { } catch (ex) {
} }

Loading…
Cancel
Save