Spaces:
Paused
Paused
Commit History
-
Add real per-user login (auth protection for the whole app)
G Rohit Sudarsen +1: Claude Sonnet 5Backend (auth.py, new): - users table in the same Postgres db.py already manages (bcrypt-hashed passwords), a stateless JWT session token signed with a new AUTH_SECRET_KEY Space secret. - POST /auth/login, GET /auth/me. No POST /auth/register - accounts are created by scripts/create_admin_user.py, run locally with getpass so a plaintext password never crosses the network or lands in a log. - Depends(auth.require_user) added to every real endpoint that touches app data (/predict, /usage, /documents*, /redact-preview, /cache/commit, all /admin/*) - fails closed (401/503), unlike every other dependency in this app which degrades gracefully. GET /health stays public (infra liveness check, no app data). Frontend: - New Login screen (components/auth/) gating the whole app - App.jsx shows it whenever there's no valid session, verified once per load against GET /auth/me. Every real API call in lib/api.js now sends Authorization: Bearer <token>; a 401 anywhere clears the …003b799