From 8fab1e2ab6ca553c9e2c3a41118c4ff6a3f3748c Mon Sep 17 00:00:00 2001 From: Jorge Fernando Date: Thu, 22 Oct 2026 00:01:30 -0300 Subject: [PATCH] feat(hotspot): login page redireciona para o portal INCTG e login por voucher no portal --- backend/public/index.html | 47 +++++++++++++++++++++++++++++++++---- mikrotik/hotspot-login.html | 27 +++++++++++++++++++++ mikrotik/setup-hotspot.rsc | 24 ++++++++++++++----- 3 files changed, 87 insertions(+), 11 deletions(-) create mode 100644 mikrotik/hotspot-login.html diff --git a/backend/public/index.html b/backend/public/index.html index e981076..925de50 100644 --- a/backend/public/index.html +++ b/backend/public/index.html @@ -484,6 +484,21 @@
+ +
+ + +
@@ -562,13 +577,13 @@
    -
  1. Volte às configurações de Wi-Fi do celular
  2. -
  3. Conecte em Convidados-Pix (se ainda não estiver)
  4. -
  5. Abra qualquer site para exibir o login
  6. -
  7. Digite o usuário e a senha acima
  8. +
  9. Toque no botão Conectar agora abaixo
  10. +
  11. Se pedir, conecte em Convidados-Pix
  12. +
  13. Pronto: seu acesso já estará liberado
- + + ← Voltar aos planos @@ -755,6 +770,28 @@ $('payerNext').addEventListener('click', () => checkout(selectedPlanId)); $('payerCpf').addEventListener('input', (e) => { e.target.value = maskCpf(e.target.value); }); + // ===== Login no hotspot (voucher) ===== + const HS_LOGIN = 'http://10.10.10.1/login'; + + function hsUrl(user, pass) { + return HS_LOGIN + '?username=' + encodeURIComponent(user) + '&password=' + encodeURIComponent(pass); + } + + $('showLogin').addEventListener('click', () => { + $('loginBox').classList.toggle('hidden'); + }); + + $('hsConnect').addEventListener('click', () => { + const u = $('hsUser').value.trim(); + const p = $('hsPass').value; + if (!u || !p) { toast('Informe usuário e senha'); return; } + window.location.href = hsUrl(u, p); + }); + + $('hsAutoLogin').addEventListener('click', () => { + window.location.href = hsUrl($('vUser').textContent, $('vPass').textContent); + }); + loadPlans(); diff --git a/mikrotik/hotspot-login.html b/mikrotik/hotspot-login.html new file mode 100644 index 0000000..0acc4e2 --- /dev/null +++ b/mikrotik/hotspot-login.html @@ -0,0 +1,27 @@ + + + + + +INCTG Wi-Fi + + + + +
+
+ Abrindo o portal INCTG... +

Se nao abrir, toque aqui

+
+ + + diff --git a/mikrotik/setup-hotspot.rsc b/mikrotik/setup-hotspot.rsc index c9032e0..87d4d7c 100644 --- a/mikrotik/setup-hotspot.rsc +++ b/mikrotik/setup-hotspot.rsc @@ -27,7 +27,7 @@ /ip pool add name=guest-pool ranges=($guestIP . "10-")($guestIP . "50") /ip pool set [find name=guest-pool] ranges=("10.10.10.10-10.10.10.50") -/ip hotspot profile add name=hs-guest hotspot-interface=bridge-guest html-directory=hotspot login-by=http-chap dns-name="" comment="perfil hotspot convidados" +/ip hotspot profile add name=hs-guest hotspot-interface=bridge-guest html-directory=hotspot login-by=cookie,http-chap,http-pap dns-name="" comment="perfil hotspot convidados" /ip hotspot add name=guest-hotspot interface=bridge-guest address-pool=guest-pool profile=hs-guest lease-time=1h disabled=no # ===== 3. PERFIS DE PLANO (nomes devem bater com o backend) ===== @@ -56,11 +56,23 @@ add chain=forward src-address=$guestSubnet dst-address=172.16.0.0/12 action=drop add chain=input src-address=$guestSubnet dst-address=$guestIP action=drop comment="guest nao gerencia o MikroTik" add chain=input src-address=$guestSubnet action=drop comment="guest so usa hotspot" -# ===== 6. WALLED GARDEN (fontes do portal antes do login) ===== -/ip hotspot walled-garden remove [find dst-host="fonts.googleapis.com"] -/ip hotspot walled-garden add dst-host=fonts.googleapis.com action=accept comment="fontes portal" -/ip hotspot walled-garden remove [find dst-host="fonts.gstatic.com"] -/ip hotspot walled-garden add dst-host=fonts.gstatic.com action=accept comment="fontes portal" +# ===== 6. WALLED GARDEN (portal antes do login) ===== +# Portal publico (Cloudflare) - necessario para o convidado abrir o portal +# antes de autenticar. As faixas cobrem os IPs anycast usados pelo dominio. +/ip hotspot walled-garden ip +add dst-address=104.16.0.0/13 dst-port=443 protocol=tcp action=accept comment="pix-portal-cloudflare" +add dst-address=172.64.0.0/13 dst-port=443 protocol=tcp action=accept comment="pix-portal-cloudflare" + +# Portal local (fallback, caso use o backend direto na LAN) +/ip hotspot walled-garden ip +add dst-address=192.168.3.100 dst-port=3000 protocol=tcp action=accept comment="pix: portal pagamento" + +# ===== 6.1 PAGINA DE LOGIN CUSTOMIZADA ===== +# Substituir hotspot/login.html e hotspot/alogin.html pelo arquivo +# mikrotik/hotspot-login.html (redireciona para o portal INCTG). +# Via FTP: +# curl -T hotspot-login.html ftp://USER:PASS@192.168.3.81/hotspot/login.html +# curl -T hotspot-login.html ftp://USER:PASS@192.168.3.81/hotspot/alogin.html # ===== 7. LIMPA HOTSPOT ANTIGO (se houver) ===== /ip hotspot user remove [find where comment~"pix"]