dak.c2s/backend/app/config.py
CCS Admin d5db84d93f feat: add self-service password reset via email
Adds "Passwort vergessen?" to login page with email-based password
reset flow. Backend generates secure token (SHA-256 hashed, 1h expiry),
sends reset link via SMTP, and validates on submission. Includes rate
limiting (3 requests/hour/email), audit logging, and account unlock
on successful reset. New ResetPasswordPage with password confirmation.

New DB table: password_reset_tokens (migration 008).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 14:56:07 +00:00

51 lines
1.4 KiB
Python

# backend/app/config.py
from urllib.parse import quote_plus
from pydantic_settings import BaseSettings
from functools import lru_cache
class Settings(BaseSettings):
# Database
DB_HOST: str = "localhost"
DB_PORT: int = 3306
DB_NAME: str = "dak_c2s"
DB_USER: str = "dak_c2s_admin"
DB_PASSWORD: str = ""
# JWT
JWT_SECRET_KEY: str = "change-me-in-production"
JWT_ALGORITHM: str = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES: int = 15
REFRESH_TOKEN_EXPIRE_DAYS: int = 7
# SMTP
SMTP_HOST: str = "smtp.complexcaresolutions.de"
SMTP_PORT: int = 465
SMTP_USER: str = "noreply@complexcaresolutions.de"
SMTP_PASSWORD: str = ""
SMTP_FROM: str = "noreply@complexcaresolutions.de"
# App
APP_NAME: str = "DAK Zweitmeinungs-Portal"
FRONTEND_BASE_URL: str = "https://dak.complexcaresolutions.de"
CORS_ORIGINS: str = "http://localhost:5173,https://dak.complexcaresolutions.de"
MAX_UPLOAD_SIZE: int = 20971520 # 20MB
VERSICHERUNG_FILTER: str = "DAK"
@property
def database_url(self) -> str:
password = quote_plus(self.DB_PASSWORD)
return (
f"mysql+pymysql://{self.DB_USER}:{password}"
f"@{self.DB_HOST}:{self.DB_PORT}/{self.DB_NAME}?charset=utf8mb4"
)
class Config:
env_file = ".env"
env_file_encoding = "utf-8"
@lru_cache
def get_settings() -> Settings:
return Settings()