Jinja2 fix, JFHR support, template.render() bypass for cache bug

This commit is contained in:
Roger Joys
2026-03-30 10:25:19 -07:00
parent b9f712504c
commit c9d4969e25
22 changed files with 16 additions and 8 deletions

0
.env.example Normal file → Executable file
View File

0
.gitignore vendored Normal file → Executable file
View File

0
.idea/.gitignore generated vendored Normal file → Executable file
View File

0
.idea/misc.xml generated Normal file → Executable file
View File

0
.idea/modules.xml generated Normal file → Executable file
View File

0
.idea/unifi-guest-portal.iml generated Normal file → Executable file
View File

0
.idea/vcs.xml generated Normal file → Executable file
View File

0
Dockerfile Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

0
app/__init__.py Normal file → Executable file
View File

0
app/auth.py Normal file → Executable file
View File

0
app/config.py Normal file → Executable file
View File

24
app/main.py Normal file → Executable file
View File

@@ -114,11 +114,19 @@ async def callback(request: Request, code: str, state: str):
"message": "Failed to authorize your device. Please try again or ask for help." "message": "Failed to authorize your device. Please try again or ask for help."
}) })
return templates.TemplateResponse("success.html", {
"request": request, try:
"site": site, template = templates.env.get_template("success.html")
"userinfo": userinfo, html = template.render(
"duration_hours": duration // 60, request=request,
"original_url": original_url, site={"id": site.id, "name": site.name},
"user_agent": user_agent, userinfo=userinfo,
}) duration_hours=duration // 60,
original_url=original_url,
user_agent=user_agent,
)
return HTMLResponse(html)
except Exception as e:
logger.error("Success template error: %s", str(e))
return RedirectResponse(original_url or "http://captive.apple.com/hotspot-detect.html")

0
app/static/pup.jpg Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

0
app/templates/base.html Normal file → Executable file
View File

0
app/templates/enroll-success.html Normal file → Executable file
View File

0
app/templates/error.html Normal file → Executable file
View File

0
app/templates/success.html Normal file → Executable file
View File

0
app/unifi.py Normal file → Executable file
View File

0
docker-compose.yml Normal file → Executable file
View File

0
nginx.conf Normal file → Executable file
View File

0
requirements.txt Normal file → Executable file
View File