- Cont demo (demo@example.com/demo1234) activ implicit, identificat prin settings.demo_email — fără configurare în env; DEMO_EMAIL="" îl dezactivează - Contul demo nu poate fi modificat prin API (email/parolă/status blocate 403) - reset_demo.py: șterge idempotent toate datele demo și recrează proprietatea demo cu 3 spații și 5 rezervări exemplu cu date relative la ziua curentă - entrypoint.sh: reset la boot + buclă la 3h (DEMO_RESET_INTERVAL) - start.sh (dev): reset la fiecare pornire - Login.vue: hint cu credențialele demo (click = precompletare) și mesajul de resetare la 3 ore Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
18 lines
621 B
Python
18 lines
621 B
Python
"""Helpers for the public demo account.
|
|
|
|
The demo account is identified by email (settings.demo_email, env DEMO_EMAIL)
|
|
so no schema change is needed. Its credentials and profile are locked through
|
|
the API and its data is recreated daily by reset_demo.py.
|
|
"""
|
|
from app.core.config import settings
|
|
from app.models.user import User
|
|
|
|
DEMO_LOCKED_DETAIL = "Contul demo nu poate fi modificat."
|
|
|
|
|
|
def is_demo_user(user: User | None) -> bool:
|
|
"""Return True if the given user is the configured demo account."""
|
|
if user is None or not settings.demo_email:
|
|
return False
|
|
return user.email == settings.demo_email
|