Files
leocrm/app/schemas/auth.py
T
Agent Zero 727d86614e Security fixes: P0-P2 complete (22 fixes)
P0 (7): Auth-bypass removed, migrations fixed, plugin-upload disabled, RLS FORCE+WITH CHECK, plugin double-registration fixed, persistent volume, domain removed
P1 (11): User/tenant model, Redis centralized, worker separated, transactional outbox, XSS fixed, DMS chunked streaming, permissions unified, password reset, metrics secured, config/docs fixed, cross-tenant FK
P2 (4): Contact model normalized, cross-imports reduced 94%, commands+state machines for contacts/dms/mail/calendar, SPA path-traversal

8 new migrations, 99 unit tests, 13 commands, 8 contracts, 72 files changed
2026-07-25 21:03:46 +02:00

38 lines
1.1 KiB
Python

"""Auth schemas."""
from __future__ import annotations
from pydantic import BaseModel, EmailStr, Field
class LoginRequest(BaseModel):
email: EmailStr = Field(..., examples=["admin@leocrm.local"])
password: str = Field(..., min_length=1, examples=["secure-password"])
tenant_slug: str | None = Field(None, description="Tenant slug to select tenant at login", examples=["tenant-a"])
class PasswordResetRequest(BaseModel):
email: EmailStr
class PasswordResetConfirm(BaseModel):
token: str = Field(..., min_length=1)
new_password: str = Field(..., min_length=8)
class SwitchTenantRequest(BaseModel):
tenant_id: str = Field(..., min_length=1)
class AuthResponse(BaseModel):
user_id: str = Field(..., examples=["550e8400-e29b-41d4-a716-446655440000"])
email: str = Field(..., examples=["admin@leocrm.local"])
name: str = Field(..., examples=["Admin User"])
role: str = Field(..., examples=["admin"])
tenant_id: str = Field(..., examples=["550e8400-e29b-41d4-a716-446655440001"])
tenant_name: str | None = Field(None, examples=["Acme GmbH"])
class MessageResponse(BaseModel):
message: str