From d268e581bdffbff934e29cc9511868bf6f09c251 Mon Sep 17 00:00:00 2001 From: Jon Ander Oribe Date: Tue, 20 Jan 2026 07:07:47 +0100 Subject: [PATCH 1/2] Enhance login UX with JS feedback and update docs Added a new login.js script to provide visual feedback and prevent double submission on the login form. Updated login.html to include the script and wire up the login button. Clarified credential configuration instructions in README.md. --- README.md | 4 +++- static/js/core/login.js | 34 ++++++++++++++++++++++++++++++++++ templates/login.html | 3 ++- 3 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 static/js/core/login.js diff --git a/README.md b/README.md index 49bed63..e061067 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,9 @@ docker compose up -d ### Open the Interface -After starting, open **http://localhost:5050** in your browser. The username and password is admin:admin +After starting, open **http://localhost:5050** in your browser. The username and password is admin:admin + +The credentials can be change in the ADMIN_USERNAME & ADMIN_PASSWORD variables in config.py --- diff --git a/static/js/core/login.js b/static/js/core/login.js new file mode 100644 index 0000000..4547de0 --- /dev/null +++ b/static/js/core/login.js @@ -0,0 +1,34 @@ +/** + * Handles the visual transition and submission lock for the authorization terminal. + * @param {Event} event - The click event from the submission button. + */ +function login(event) { + const btn = event.currentTarget; + const form = btn.closest('form'); + + // Validate form requirements before triggering visual effects + if (!form.checkValidity()) { + return; // Allow the browser to handle native "required" field alerts + } + + // 1. Visual Feedback: Transition to "Processing" state + btn.style.color = "#ff4d4d"; + btn.style.borderColor = "#ff4d4d"; + btn.style.textShadow = "0 0 10px #ff4d4d"; + btn.style.transform = "scale(0.95)"; + + // Update button text to reflect terminal status + const btnText = btn.querySelector('.btn-text'); + if (btnText) { + btnText.innerText = "AUTHORIZING..."; + } + + // 2. Security Lock: Prevent redundant requests (Double-click spam) + // A 10ms delay ensures the browser successfully dispatches the POST request + // before the UI element becomes non-interactive. + setTimeout(() => { + btn.style.pointerEvents = "none"; + btn.style.opacity = "0.7"; + btn.style.cursor = "not-allowed"; + }, 10); +} \ No newline at end of file diff --git a/templates/login.html b/templates/login.html index 6662aa9..8c47d67 100644 --- a/templates/login.html +++ b/templates/login.html @@ -4,6 +4,7 @@ iNTERCEPT // Restricted Access + @@ -48,7 +49,7 @@ - From 664ae5b5ce5d825d815369c3e8ce47791b6fd2e6 Mon Sep 17 00:00:00 2001 From: Jon Ander Oribe Date: Tue, 20 Jan 2026 07:59:42 +0100 Subject: [PATCH 2/2] Update requirements.txt Added flask-limiter>=2.5.4 to the requirements --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index bc6fa65..791f646 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ # Core dependencies flask>=2.0.0 +flask-limiter>=2.5.4 requests>=2.28.0 # BLE scanning with manufacturer data detection (optional - for TSCM)