From 401172eb368220acfcf7503b0ea535191f765bb8 Mon Sep 17 00:00:00 2001 From: billz Date: Sat, 22 Mar 2025 03:11:03 -0700 Subject: [PATCH 1/7] Initial commit --- app/img/uri-qr-code.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 app/img/uri-qr-code.php diff --git a/app/img/uri-qr-code.php b/app/img/uri-qr-code.php new file mode 100755 index 00000000..41124dfb --- /dev/null +++ b/app/img/uri-qr-code.php @@ -0,0 +1,29 @@ + Date: Sat, 22 Mar 2025 03:11:47 -0700 Subject: [PATCH 2/7] Update w/ logout() method --- src/RaspAP/Auth/HTTPAuth.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/RaspAP/Auth/HTTPAuth.php b/src/RaspAP/Auth/HTTPAuth.php index d32a36ad..a28f9212 100755 --- a/src/RaspAP/Auth/HTTPAuth.php +++ b/src/RaspAP/Auth/HTTPAuth.php @@ -74,6 +74,20 @@ class HTTPAuth return false; } + /* + * Logs out the administrative user + */ + public function logout(): void + { + session_unset(); // unset all session variables + session_destroy(); // destroy the session + $redirectUrl = $_SERVER['REQUEST_URI']; + if (strpos($redirectUrl, '/login') === false) { + header('Location: /login?action=' . urlencode($redirectUrl)); + exit(); + } + } + /* * Gets the current authentication config * return array $config From 05e20e3bab8e92dd6b19d8a72f31cf5249ce5ced Mon Sep 17 00:00:00 2001 From: billz Date: Sat, 22 Mar 2025 03:12:09 -0700 Subject: [PATCH 3/7] Handle logout action --- includes/admin.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/admin.php b/includes/admin.php index 95f2b26c..61dd21ed 100755 --- a/includes/admin.php +++ b/includes/admin.php @@ -35,6 +35,8 @@ function DisplayAuthConfig($username) } else { $status->addMessage('Old password does not match', 'danger'); } + } elseif (isset($_POST['logout'])) { + $auth->logout(); } echo renderTemplate( From 51a0ce220cf4f6a864c1d11c7ed83a0f820f5c2f Mon Sep 17 00:00:00 2001 From: billz Date: Sat, 22 Mar 2025 03:12:46 -0700 Subject: [PATCH 4/7] Update w/ disableValidation() to support logout btn --- app/js/custom.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/js/custom.js b/app/js/custom.js index 7d9e92e9..7b036913 100644 --- a/app/js/custom.js +++ b/app/js/custom.js @@ -1019,6 +1019,14 @@ document.addEventListener("DOMContentLoaded", function () { } }); +function disableValidation(form) { + form.removeAttribute("novalidate"); + form.classList.remove("needs-validation"); + form.querySelectorAll("[required]").forEach(function (field) { + field.removeAttribute("required"); + }); +} + $(document).ready(function() { const $htmlElement = $('html'); const $modeswitch = $('#night-mode'); From 3e54b1d7bb952e1d86d4d8d2eef87926fc4caa52 Mon Sep 17 00:00:00 2001 From: billz Date: Sat, 22 Mar 2025 03:14:11 -0700 Subject: [PATCH 5/7] Remove authentication sidebar item (redundant) --- src/RaspAP/UI/Sidebar.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/RaspAP/UI/Sidebar.php b/src/RaspAP/UI/Sidebar.php index 8d79f9de..fe819987 100644 --- a/src/RaspAP/UI/Sidebar.php +++ b/src/RaspAP/UI/Sidebar.php @@ -39,9 +39,6 @@ class Sidebar { ); $this->addItem(_(getProviderValue($_SESSION["providerID"], "name")), 'fas fa-shield-alt', 'provider_conf', 90, fn() => RASPI_VPN_PROVIDER_ENABLED - ); - $this->addItem(_('Authentication'), 'fas fa-user-lock', 'auth_conf', 100, - fn() => RASPI_CONFAUTH_ENABLED ); $this->addItem(_('Data usage'), 'fas fa-chart-area', 'data_use', 110, fn() => RASPI_VNSTAT_ENABLED From af2927f05b8a2f0007f534d7f2d45c5dae09cad2 Mon Sep 17 00:00:00 2001 From: billz Date: Sat, 22 Mar 2025 03:16:53 -0700 Subject: [PATCH 6/7] Update w/ qr code doc link --- templates/login.php | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/login.php b/templates/login.php index 57207245..ab8cfbd0 100755 --- a/templates/login.php +++ b/templates/login.php @@ -32,6 +32,7 @@
+ RaspAP docs From 734043dee68709da6c242ecc48df4d5592e8da52 Mon Sep 17 00:00:00 2001 From: billz Date: Sat, 22 Mar 2025 03:17:23 -0700 Subject: [PATCH 7/7] Define button object, add logout btn --- templates/admin.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/templates/admin.php b/templates/admin.php index e8a34cd7..c528e781 100755 --- a/templates/admin.php +++ b/templates/admin.php @@ -1,10 +1,17 @@ + + + " /> + " onclick="disableValidation(this.form)"/> + + +
-
- +
+
@@ -58,7 +65,7 @@
- " /> +