Revalidate captive Wi-Fi with one portal navigation after API login
build-image / build-push (push) Successful in 2m44s
build-image / build-push (push) Successful in 2m44s
This commit is contained in:
1 parent
4c7440e233
commit
8d38a9136b
3 files changed
+56
-3
No files matched your search
@@ -838,6 +838,20 @@
|
||||
return;
|
||||
}
|
||||
if (d.authenticated) {
|
||||
// Captive-portal assistants re-evaluate the network on top-level navigation.
|
||||
// An API login plus a DOM update leaves some phones using the captive state.
|
||||
// Navigate once per server window; reloading must never extend its deadline.
|
||||
if (Number.isFinite(d.expiresAt) && d.expiresAt > Date.now() &&
|
||||
sessionStorage.getItem('freeAccessConfirmedUntil') !== String(d.expiresAt)) {
|
||||
sessionStorage.setItem('freeAccessConfirmedUntil', String(d.expiresAt));
|
||||
const target = new URL(location.href);
|
||||
target.searchParams.set('mac', mac);
|
||||
target.searchParams.set('free', '1');
|
||||
target.searchParams.set('access', String(d.expiresAt));
|
||||
message.textContent = 'Acesso autorizado. Atualizando a conexão deste aparelho…';
|
||||
window.location.replace(target.href);
|
||||
return;
|
||||
}
|
||||
if (d.probeToken) verifyClientInternet(d.probeToken);
|
||||
sessionStorage.removeItem('freeLoginAttemptUntil');
|
||||
clearInterval(window.freeAccessTimer);
|
||||
|
||||
Reference in new issue
Block a user