From 09740c81559f1ca9cd37feacecadef63f9aaf85d Mon Sep 17 00:00:00 2001 From: noiemany <51255434+compnew2006@users.noreply.github.com> Date: Mon, 23 Nov 2026 21:56:18 +0200 Subject: [PATCH 1/2] fix: keep guest voucher approval accessible --- tests/test_guest_captive.py | 19 +++++++++++++++++++ web/guest_pending.html | 9 ++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/tests/test_guest_captive.py b/tests/test_guest_captive.py index bb2fa5a..c021806 100644 --- a/tests/test_guest_captive.py +++ b/tests/test_guest_captive.py @@ -59,6 +59,25 @@ def test_guest_pending_page_serves_html(captive_env): assert "Quota Manager" in r.text +def test_guest_portal_hidden_states_and_reduced_motion(captive_env): + _, _, _, app = captive_env + with TestClient(app) as client: + html = client.get("/guest/pending").text + + assert "[hidden]" in html and "display: none !important" in html + assert "@media (prefers-reduced-motion: reduce)" in html + assert "voucherForm.contains(document.activeElement)" in html + assert "document.getElementById('browse-btn').focus()" in html + + +def test_guest_voucher_redemption_sends_csrf_header(captive_env): + _, _, _, app = captive_env + with TestClient(app) as client: + html = client.get("/guest/pending").text + + assert "'X-QM-CSRF': '1'" in html + + def test_captive_probes_redirect_pending_guests(captive_env): database, service, holder, app = captive_env diff --git a/web/guest_pending.html b/web/guest_pending.html index 90a542b..812afca 100644 --- a/web/guest_pending.html +++ b/web/guest_pending.html @@ -248,6 +248,7 @@ margin: 16px 0 20px; text-align: start; } + [hidden] { display: none !important; } .voucher-form label { color: var(--text); font-size: .9rem; font-weight: 600; } .voucher-form input { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; @@ -272,6 +273,10 @@ 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.3; transform: scale(0.85); } } + @media (prefers-reduced-motion: reduce) { + .live-indicator, .pulse-ring { animation: none; } + .pulse-ring { display: none; } + } .btn { width: 100%; @@ -451,7 +456,7 @@

Awaiting Administrator Approval

const response = await fetch('/api/guest/voucher/redeem', { method: 'POST', credentials: 'same-origin', - headers: { 'Content-Type': 'application/json' }, + headers: { 'Content-Type': 'application/json', 'X-QM-CSRF': '1' }, body: JSON.stringify({ code: voucherCode.value.trim() }) }); const errorBody = !response.ok @@ -545,6 +550,7 @@

Awaiting Administrator Approval

const msgEn = document.getElementById('msg-en'); const liveBox = document.getElementById('live-status-box'); const actionBox = document.getElementById('action-container'); + const voucherHadFocus = voucherForm.contains(document.activeElement); voucherForm.hidden = data.status !== 'pending'; if (data.approved || (!data.blocked && data.is_guest) || (data.status === 'ok' && !data.is_guest)) { @@ -576,6 +582,7 @@

Awaiting Administrator Approval

🌐 تصفح الإنترنت الآن (Start Browsing) `; + if (voucherHadFocus) document.getElementById('browse-btn').focus(); // Start countdown to redirect let sec = 3; From ae953c172d5883d7b280abb11045afaceb873f01 Mon Sep 17 00:00:00 2001 From: Youssef Alkhodary <82382970+UserJoo9@users.noreply.github.com> Date: Tue, 24 Nov 2026 07:20:14 +0200 Subject: [PATCH 2/2] CHANGELOG: guest page fixes from #50 (credit @compnew2006) --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46887f4..0e0db7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Added: - **Internet schedule** (new page). Turn the internet off at set times of the week for chosen people (all their devices) or single devices: bedtime on school nights, study time, meal times. One click starts from a ready plan ("School nights", "Every night", "Study time", "Meal times"); a schedule can have several times, a time can run past midnight, and dates can be marked as days off (holidays, Eid). **Bonus time** gives a few extra minutes without changing the schedule. **Always allowed** sites (a school platform, a study site) keep working during every schedule. While a schedule is on, the device's card shows when the internet comes back, the home network (printer, shared drives, the dashboard) keeps working, and the cut is done by the gateway itself, so it works on any phone, tablet, TV or console with no app. Each device gets its end time in the system kernel, so it comes back online on time even if the gateway service restarts or stops. Sites on the "always allowed" list only open on devices that look names up through the gateway; a phone with Private DNS (or a browser with secure DNS) turned on keeps them blocked during a schedule. Contributed by @amr-elgharip2006. Closes #32. Fixed: +- The guest waiting page: entering a guest code now also works when the same browser is logged in to the dashboard, the "start browsing" button gets the focus after approval, hidden parts stay hidden, and the pulsing animation stops for people who turned off motion on their device. Contributed by @compnew2006. - Website block/allow rules were rebuilt every time the gateway started, so their numbers changed on each restart. They are now kept as they are. If an older version was interrupted in the middle of that rebuild (for example by a power cut), the rules it left behind are put back on the next start instead of being lost. Contributed by @compnew2006. ## [0.5.11] — 2026-11-24