feat: datenmodell für benutzer, sessions und login-versuche

- Tabellen users, sessions, login_attempts (Migration 0002)
- UTCDateTime speichert UTC in SQLite und liefert aware datetimes
- Tests legen das Schema über die echten Migrationen an
- Test prüft, dass Migrationen und Modelle übereinstimmen

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dbildhauerandClaude Opus 5.5 committed 2026-10-25 11:04:33 +01:00
1 parent d9b7baf788
commit d4cf8bdddd
12 files changed
+283 -11

No files matched your search

+20
View File
@@ -11,10 +11,30 @@ class Settings(BaseSettings):
static_dir: Path = Path("/app/static")
log_level: str = "info"
# Comma-separated list of origins allowed for state-changing requests and WebSockets
allowed_origins: str = "https://clip.webbildhauer.com"
cookie_secure: bool = True
session_idle_days: int = 30
session_max_days: int = 90
login_max_failures_per_user: int = 5
login_max_failures_per_ip: int = 20
login_failure_window_minutes: int = 15
# Only meaningful once the real client IP is known (FORWARDED_ALLOW_IPS set to the proxy)
login_ip_lockout: bool = False
initial_admin_username: str | None = None
initial_admin_password: str | None = None
@property
def database_url(self) -> str:
return f"sqlite:///{self.data_dir / 'app.db'}"
@property
def allowed_origin_list(self) -> list[str]:
return [o.strip().rstrip("/") for o in self.allowed_origins.split(",") if o.strip()]
@lru_cache
def get_settings() -> Settings: