Changed Success UX
This commit is contained in:
@@ -96,6 +96,7 @@ async def callback(request: Request, code: str, state: str):
|
||||
|
||||
duration = get_guest_duration(userinfo, site.default_duration_minutes)
|
||||
success = authorize_guest(site, mac, duration)
|
||||
user_agent = request.headers.get("user-agent", "").lower()
|
||||
|
||||
if not success:
|
||||
return templates.TemplateResponse("error.html", {
|
||||
@@ -109,4 +110,5 @@ async def callback(request: Request, code: str, state: str):
|
||||
"userinfo": userinfo,
|
||||
"duration_hours": duration // 60,
|
||||
"original_url": original_url,
|
||||
"user_agent": user_agent,
|
||||
})
|
||||
@@ -12,8 +12,17 @@
|
||||
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 %}
|
||||
|
||||
Reference in New Issue
Block a user