fix: dedent auth/me and auth/logout routes
Some checks are pending
Check Python Version Consistency / Check Python Version (push) Waiting to run

This commit is contained in:
Chris Christiansen 2026-06-28 01:49:35 +00:00
parent d9a553a43b
commit c45613982b

24
main.py
View File

@ -133,19 +133,19 @@ async def auth(request: Request):
request.session['user'] = dict(user)
return RedirectResponse(url='/static/billing-dashboard.html')
@app.get("/auth/me")
async def me(request: Request):
email = request.headers.get("x-goog-authenticated-user-email", "")
if not email:
raise HTTPException(status_code=401, detail="Not authenticated")
# IAP sender "accounts.google.com:chris@vauco.no" - vi fjerner prefix
clean_email = email.split(":")[-1]
return JSONResponse({"email": clean_email, "authenticated": True})
@app.get("/auth/me")
async def me(request: Request):
email = request.headers.get("x-goog-authenticated-user-email", "")
if not email:
raise HTTPException(status_code=401, detail="Not authenticated")
# IAP sender "accounts.google.com:chris@vauco.no" - vi fjerner prefix
clean_email = email.split(":")[-1]
return JSONResponse({"email": clean_email, "authenticated": True})
@app.get('/auth/logout')
async def logout(request: Request):
request.session.pop('user', None)
return RedirectResponse(url='/static/billing-dashboard.html')
@app.get('/auth/logout')
async def logout(request: Request):
request.session.pop('user', None)
return RedirectResponse(url='/static/billing-dashboard.html')
ALLOWED_EMAILS = [email.strip() for email in os.environ.get("ALLOWED_EMAILS", "").split(",") if email.strip()]