User Authentication ## Business Purpose Provide a secure login, registration, and password recovery system for users to access the platform. ## Current Behaviors - Login: Users submit email and password; server validates credentials and returns a JWT token stored in the client cache login.tsx:65.
Signup: New users register with name, email, and password; server creates a user via private API and redirects to login signup.tsx:74.
Password Recovery: Users request a password reset email; a recovery token is sent and validated recover-password.tsx:60.
Token Management: The useAuth hook manages login state, token storage, and logout by clearing cached queries useAuth.ts:30.
Backend Security: Passwords are hashed using bcrypt (upgraded to Argon2) and tokens are created with expiration security.py:22. ## Technical Implementation - Frontend Routes: Login form at login.tsx:37-65, signup form at signup.tsx:35-74, password recovery at recover-password.tsx:35-68, reset password at reset-password.tsx:42-95.
API Calls: SDK functions loginAccessToken, registerUser, recoverPassword, resetPassword (sdk.gen.ts:128-165, 356-375).
State Management: useAuth hook uses React Query's queryClient to store/clear token useAuth.ts:14.
Security Utilities: create_access_token with expires_delta, verify_password, get_password_hashsecurity.py:22.
Test Fixtures: superuser_token_headers and normal_user_token_headers created in conftest.py conftest.py:34. ## Definition of Done - Login with valid credentials returns a 200 response and sets a token in the client cache login.spec.ts:26.
Registration creates a new user and shows a success toast sign-up.spec.ts:36.