• Aryan Noshirvani's avatar
    Replace HTTP Basic's native popup with a real branded login page · 375a447d
    Aryan Noshirvani authored
    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
    375a447d
Name
Last commit
Last update
..
routers Loading commit data...
static Loading commit data...
__init__.py Loading commit data...
main.py Loading commit data...