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)
|
duration = get_guest_duration(userinfo, site.default_duration_minutes)
|
||||||
success = authorize_guest(site, mac, duration)
|
success = authorize_guest(site, mac, duration)
|
||||||
|
user_agent = request.headers.get("user-agent", "").lower()
|
||||||
|
|
||||||
if not success:
|
if not success:
|
||||||
return templates.TemplateResponse("error.html", {
|
return templates.TemplateResponse("error.html", {
|
||||||
@@ -109,4 +110,5 @@ async def callback(request: Request, code: str, state: str):
|
|||||||
"userinfo": userinfo,
|
"userinfo": userinfo,
|
||||||
"duration_hours": duration // 60,
|
"duration_hours": duration // 60,
|
||||||
"original_url": original_url,
|
"original_url": original_url,
|
||||||
|
"user_agent": user_agent,
|
||||||
})
|
})
|
||||||
@@ -12,7 +12,16 @@
|
|||||||
el.textContent = seconds;
|
el.textContent = seconds;
|
||||||
if (seconds <= 0) {
|
if (seconds <= 0) {
|
||||||
clearInterval(timer);
|
clearInterval(timer);
|
||||||
window.location.href = "{{ original_url }}";
|
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);
|
}, 1000);
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user