Initial commit: MyMidas personal finance tracker
Full-stack self-hosted finance app with FastAPI backend and React frontend. Features: - Accounts, transactions, budgets, investments with GBP base currency - CSV import with auto-detection for 10 UK bank formats - ML predictions: spending forecast, net worth projection, Monte Carlo - 7 selectable themes (Obsidian, Arctic, Midnight, Vault, Terminal, Synthwave, Ledger) - Receipt/document attachments on transactions (JPEG, PNG, WebP, PDF) - AES-256-GCM field encryption, RS256 JWT, TOTP 2FA, RLS, audit log - Encrypted nightly backups + key rotation script - Mobile-responsive layout with bottom nav Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
commit
61a7884ee5
127 changed files with 13323 additions and 0 deletions
64
backend/app/schemas/auth.py
Normal file
64
backend/app/schemas/auth.py
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
import uuid
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, EmailStr, field_validator
|
||||
|
||||
|
||||
class RegisterRequest(BaseModel):
|
||||
email: EmailStr
|
||||
password: str
|
||||
display_name: str
|
||||
|
||||
@field_validator("password")
|
||||
@classmethod
|
||||
def password_strength(cls, v: str) -> str:
|
||||
if len(v) < 12:
|
||||
raise ValueError("Password must be at least 12 characters")
|
||||
if not any(c.isupper() for c in v):
|
||||
raise ValueError("Password must contain an uppercase letter")
|
||||
if not any(c.isdigit() for c in v):
|
||||
raise ValueError("Password must contain a digit")
|
||||
return v
|
||||
|
||||
|
||||
class LoginRequest(BaseModel):
|
||||
email: EmailStr
|
||||
password: str
|
||||
|
||||
|
||||
class TOTPChallengeResponse(BaseModel):
|
||||
totp_required: bool = True
|
||||
challenge_token: str
|
||||
|
||||
|
||||
class TOTPLoginRequest(BaseModel):
|
||||
challenge_token: str
|
||||
totp_code: str
|
||||
|
||||
|
||||
class TokenResponse(BaseModel):
|
||||
access_token: str
|
||||
token_type: str = "bearer"
|
||||
expires_in: int # seconds
|
||||
|
||||
|
||||
class TOTPSetupResponse(BaseModel):
|
||||
secret: str
|
||||
qr_code_png_b64: str
|
||||
backup_codes: list[str]
|
||||
|
||||
|
||||
class TOTPVerifyRequest(BaseModel):
|
||||
code: str
|
||||
|
||||
|
||||
class SessionInfo(BaseModel):
|
||||
id: uuid.UUID
|
||||
ip_address: str | None
|
||||
user_agent: str | None
|
||||
last_active_at: datetime
|
||||
expires_at: datetime
|
||||
created_at: datetime
|
||||
is_current: bool = False
|
||||
|
||||
model_config = {"from_attributes": True}
|
||||
Loading…
Add table
Add a link
Reference in a new issue