mirror of
https://github.com/complexcaresolutions/dak.c2s.git
synced 2026-03-17 21:53:41 +00:00
- Add first_name, last_name, display_name, avatar_url to UserResponse - Add ProfileUpdate schema for self-service profile editing - Add MFADisableRequest schema for password-confirmed MFA disable Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
70 lines
1.5 KiB
Python
70 lines
1.5 KiB
Python
"""Pydantic v2 schemas for authentication endpoints."""
|
|
|
|
from typing import Optional
|
|
|
|
from pydantic import BaseModel, EmailStr
|
|
|
|
from app.schemas.user import UserResponse
|
|
|
|
|
|
class LoginRequest(BaseModel):
|
|
"""Credentials submitted to POST /login."""
|
|
|
|
email: EmailStr
|
|
password: str
|
|
mfa_code: Optional[str] = None
|
|
|
|
|
|
class TokenResponse(BaseModel):
|
|
"""Returned on successful login or token refresh."""
|
|
|
|
access_token: str
|
|
refresh_token: str
|
|
token_type: str = "bearer"
|
|
user: UserResponse
|
|
|
|
|
|
class RegisterRequest(BaseModel):
|
|
"""Self-service registration (requires invitation token or whitelisted domain)."""
|
|
|
|
username: str
|
|
email: EmailStr
|
|
password: str
|
|
invitation_token: Optional[str] = None
|
|
|
|
|
|
class RefreshRequest(BaseModel):
|
|
"""Request body for POST /refresh."""
|
|
|
|
refresh_token: str
|
|
|
|
|
|
class MFASetupResponse(BaseModel):
|
|
"""Returned when a user initiates MFA setup."""
|
|
|
|
secret: str
|
|
qr_uri: str
|
|
|
|
|
|
class MFAVerifyRequest(BaseModel):
|
|
"""6-digit TOTP code + secret submitted to activate MFA.
|
|
|
|
The *secret* was returned by ``/mfa/setup`` and must be echoed back so
|
|
the server can verify the code before persisting.
|
|
"""
|
|
|
|
secret: str
|
|
code: str
|
|
|
|
|
|
class ChangePasswordRequest(BaseModel):
|
|
"""Request body for changing the authenticated user's password."""
|
|
|
|
old_password: str
|
|
new_password: str
|
|
|
|
|
|
class MFADisableRequest(BaseModel):
|
|
"""Password confirmation required to disable MFA."""
|
|
|
|
password: str
|