feat: Multi-User-Unterstützung mit JWT-Authentifizierung
- User-Modell (username, password_hash, role admin/user, is_active) - Standard-Admin-Benutzer wird beim ersten Start automatisch angelegt - JWT-Tokens (HS256) für Benutzer-Sessions, konfigurierbare Ablaufzeit - API-Key bleibt für service-to-service-Calls (backward-compatible) - POST /api/v1/auth/login → JWT-Token - GET /api/v1/auth/me → aktueller Benutzer - CRUD /api/v1/users/ → Benutzerverwaltung (nur Admin) - TUI zeigt Login-Screen beim Start; nach Erfolg → MainScreen - Passwort-Hashing mit bcrypt (python-jose für JWT)
This commit is contained in:
@@ -29,6 +29,12 @@ class Settings(BaseSettings):
|
||||
# TUI Web-Modus
|
||||
web_port: int = 8001
|
||||
|
||||
# Benutzer-Authentifizierung
|
||||
secret_key: str = "change-this-secret-key-min-32-chars!!"
|
||||
token_expire_hours: int = 24
|
||||
default_admin_user: str = "admin"
|
||||
default_admin_password: str = "admin"
|
||||
|
||||
@property
|
||||
def telegram_enabled(self) -> bool:
|
||||
return bool(self.telegram_token)
|
||||
|
||||
Reference in New Issue
Block a user