From ba6b6f277a879f912fcabfd66d65b05e82466104 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Wed, 19 Jun 2019 13:27:00 +0000 Subject: [PATCH] Added external library NProgress and ajax-timeouts --- include/lucidAuth.template.php | 2 ++ public/example.php | 27 --------------------------- public/misc/script.index.js | 14 ++++++++------ 3 files changed, 10 insertions(+), 33 deletions(-) delete mode 100644 public/example.php diff --git a/include/lucidAuth.template.php b/include/lucidAuth.template.php index a4146eb..ebc8c29 100644 --- a/include/lucidAuth.template.php +++ b/include/lucidAuth.template.php @@ -15,6 +15,8 @@ $pageLayout['full'] = <<<'FULL' + +
diff --git a/public/example.php b/public/example.php deleted file mode 100644 index c31adb3..0000000 --- a/public/example.php +++ /dev/null @@ -1,27 +0,0 @@ - 'Failed to connect to MySQL: ' . mysqli_connect_error())); - exit; -} - -if ($input['action'] === 'edit') { - $mysqli->query("UPDATE users SET username='" . $input['username'] . "', email='" . $input['email'] . "', avatar='" . $input['avatar'] . "' WHERE id='" . $input['id'] . "'"); -} else if ($input['action'] === 'delete') { - $mysqli->query("UPDATE users SET deleted=1 WHERE id='" . $input['id'] . "'"); -} else if ($input['action'] === 'restore') { - $mysqli->query("UPDATE users SET deleted=0 WHERE id='" . $input['id'] . "'"); -} - -mysqli_close($mysqli); - -echo json_encode($input); diff --git a/public/misc/script.index.js b/public/misc/script.index.js index 1fd11cc..514079c 100644 --- a/public/misc/script.index.js +++ b/public/misc/script.index.js @@ -40,25 +40,27 @@ $(document).ready(function(){ xhrFields: { withCredentials: true, }, + timeout: 750, +// origin domain should be exempted from timeout +// (because origin domain can/will be different from current domain --due to traefik design). data: { ref: btoa(JSON.stringify({ action: 'login', token: data.SecureToken })) } + }).done(function() { + NProgress.inc(1 / XHR.length); })); }); $.when.apply($, XHR).then(function(){ $.each(arguments, function(_index, _arg) { - // Show progress somehow (maybe something like https://minicss.org/v2/progress) + // Finished cross-domain logins (either succesfully or through timeout) + NProgress.done(); + window.location.replace(data.Location); }); }); } - // Finished (either succesfully or through timeout) cross-domain logins -// redirect once all finished loading or timeout after $X ms -// origin domain should be exempted from timeout -// (because origin domain can/will be different from current domain --due to traefik design). - //window.location.replace(data.Location); }, 2250); } else { $('#btnlogin').css({ -- 2.45.2