Files
unifi-guest-portal/app/templates/success.html
2026-03-16 05:48:52 -07:00

29 lines
1.2 KiB
HTML

{% extends "base.html" %}
{% block content %}
<h1>You're connected!</h1>
<p>Welcome to {{ site.name }} Guest WiFi.</p>
<p>Your device has been authorized for <strong>{{ duration_hours }} hours</strong>.</p>
<p style="color: #999; font-size: 0.85rem;">This window will close in <span id="countdown">15</span> seconds...</p>
<script>
let seconds = 15;
const el = document.getElementById('countdown');
const timer = setInterval(() => {
seconds--;
el.textContent = seconds;
if (seconds <= 0) {
clearInterval(timer);
const ua = "{{ user_agent }}";
if (ua.includes("iphone") || ua.includes("ipad") || ua.includes("mac")) {
window.location.href = "http://captive.apple.com/hotspot-detect.html";
} else if (ua.includes("android")) {
window.location.href = "http://connectivitycheck.gstatic.com/generate_204";
} else if (ua.includes("windows")) {
window.location.href = "http://www.msftconnecttest.com/connecttest.txt";
} else {
window.location.href = "{{ original_url }}";
}
}
}, 1000);
</script>
{% endblock %}