diff --git a/.env.example b/.env.example old mode 100644 new mode 100755 diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/.idea/.gitignore b/.idea/.gitignore old mode 100644 new mode 100755 diff --git a/.idea/misc.xml b/.idea/misc.xml old mode 100644 new mode 100755 diff --git a/.idea/modules.xml b/.idea/modules.xml old mode 100644 new mode 100755 diff --git a/.idea/unifi-guest-portal.iml b/.idea/unifi-guest-portal.iml old mode 100644 new mode 100755 diff --git a/.idea/vcs.xml b/.idea/vcs.xml old mode 100644 new mode 100755 diff --git a/Dockerfile b/Dockerfile old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/app/__init__.py b/app/__init__.py old mode 100644 new mode 100755 diff --git a/app/auth.py b/app/auth.py old mode 100644 new mode 100755 diff --git a/app/config.py b/app/config.py old mode 100644 new mode 100755 diff --git a/app/main.py b/app/main.py old mode 100644 new mode 100755 index 224f6ce..d62418a --- a/app/main.py +++ b/app/main.py @@ -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." }) - return templates.TemplateResponse("success.html", { - "request": request, - "site": site, - "userinfo": userinfo, - "duration_hours": duration // 60, - "original_url": original_url, - "user_agent": user_agent, - }) \ No newline at end of file + + try: + template = templates.env.get_template("success.html") + html = template.render( + request=request, + site={"id": site.id, "name": site.name}, + 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") + diff --git a/app/static/pup.jpg b/app/static/pup.jpg old mode 100644 new mode 100755 diff --git a/app/templates/base.html b/app/templates/base.html old mode 100644 new mode 100755 diff --git a/app/templates/enroll-success.html b/app/templates/enroll-success.html old mode 100644 new mode 100755 diff --git a/app/templates/error.html b/app/templates/error.html old mode 100644 new mode 100755 diff --git a/app/templates/success.html b/app/templates/success.html old mode 100644 new mode 100755 diff --git a/app/unifi.py b/app/unifi.py old mode 100644 new mode 100755 diff --git a/docker-compose.yml b/docker-compose.yml old mode 100644 new mode 100755 diff --git a/nginx.conf b/nginx.conf old mode 100644 new mode 100755 diff --git a/requirements.txt b/requirements.txt old mode 100644 new mode 100755