Commit 375a447d authored by Aryan Noshirvani's avatar Aryan Noshirvani

Replace HTTP Basic's native popup with a real branded login page

HTTP Basic Auth's credential prompt is a browser-native dialog - there
is no HTML/CSS control over it at all, so "make the login screen
better" had nowhere to go under the previous setup. Switched to a
proper login page (matching the console's dark/neon theme) backed by
a random per-session cookie:

- GET/POST /login: styled form, wrong credentials redirect back with
  an inline error instead of a blank 401.
- Session tokens are secrets.token_urlsafe(32), tracked in an
  in-memory dict with a 24h expiry - not the old hardcoded
  "valid_token_xyz" bypass value this app used to ship with.
- GET /logout clears the session and cookie.
- HTTP Basic is kept as a fallback authentication path (checked
  alongside the session cookie) specifically so curl -u still works
  for scripted/API access - only interactive browser use needed the
  new login page, and this repo's own test suite and my own manual
  testing throughout this session both rely on curl -u.

Added tests/test_docs_auth.py covering the full flow: redirect when
unauthenticated, login page rendering, wrong-credential error
redirect, correct-credential session + docs/openapi access, the Basic
fallback, and logout. Also manually verified live against the running
dev instance end-to-end with curl (cookie jar) before committing.
Co-Authored-By: 's avatarClaude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
parent 383b5162
Pipeline #1002 passed with stage
in 11 minutes and 21 seconds