Compare commits

...

2 Commits

Author SHA1 Message Date
Erik Thiele
40ee841553 chore: Version auf 6.2.8 heben
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-23 16:50:08 +02:00
Erik Thiele
3a2ff20815 feat: Willkommensseite ohne Login erreichbar
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-23 16:50:08 +02:00

26
app.py
View File

@@ -51,7 +51,7 @@ CONFIG_FILE = os.path.join(BASE_DIR, "config.json") # Persistente Konfiguration
USERS_FILE = os.path.join(BASE_DIR, "users.json") # User-Datenbank USERS_FILE = os.path.join(BASE_DIR, "users.json") # User-Datenbank
HISTORY_FILE = os.path.join(BASE_DIR, "history.json") # Aktivitätsverlauf HISTORY_FILE = os.path.join(BASE_DIR, "history.json") # Aktivitätsverlauf
APP_VERSION = "6.2.7" APP_VERSION = "6.2.8"
UPLOAD_EXTENSIONS = {".jpg", ".jpeg", ".png", ".mp4"} UPLOAD_EXTENSIONS = {".jpg", ".jpeg", ".png", ".mp4"}
app = Flask(__name__) app = Flask(__name__)
@@ -942,7 +942,6 @@ def mfa_disable():
# ------------------------------------------------- # -------------------------------------------------
@app.route("/willkommen", methods=["GET", "POST"]) @app.route("/willkommen", methods=["GET", "POST"])
@app.route("/customer", methods=["GET", "POST"]) @app.route("/customer", methods=["GET", "POST"])
@login_required
def add_customer(): def add_customer():
""" """
Formular für die Willkommensseite: Formular für die Willkommensseite:
@@ -960,14 +959,21 @@ def add_customer():
logo_hinweise = [] logo_hinweise = []
site = request.args.get("site") or request.form.get("site") or "" site = request.args.get("site") or request.form.get("site") or ""
# Fallback auf ersten für den User zugänglichen Standort # Diese Seite ist bewusst ohne Login erreichbar: Am Empfang soll eine
if not site: # Begruessung auch ohne Benutzerkonto erstellt werden koennen. Ein
config = load_config() # angemeldeter User sieht weiterhin nur seine freigegebenen Standorte.
sites = get_accessible_sites(config, current_user) config = load_config()
site = sites[0] if sites else "" if current_user.is_authenticated:
erlaubte_sites = get_accessible_sites(config, current_user)
else:
erlaubte_sites = get_site_list(config)
# Prüfen, ob der User Zugriff auf den Standort hat # Fallback auf den ersten zugaenglichen Standort
if site and not current_user.can_access_site(site): if not site:
site = erlaubte_sites[0] if erlaubte_sites else ""
# Zugriff auf den Standort pruefen
if site and site not in erlaubte_sites:
abort(403) abort(403)
remember_site(site) remember_site(site)
@@ -1072,7 +1078,7 @@ def add_customer():
"contacts": list(contacts) "contacts": list(contacts)
} }
save_config(config) save_config(config)
add_history_entry("customer_added", f"Kunden ({', '.join(valid_names)}) zur Willkommensseite an Standort '{site}' hinzugefügt (Screens: {', '.join(targets)})", current_user.email) add_history_entry("customer_added", f"Kunden ({', '.join(valid_names)}) zur Willkommensseite an Standort '{site}' hinzugefügt (Screens: {', '.join(targets)})", current_user.email if current_user.is_authenticated else "nicht angemeldet")
success = (f"✅ Willkommensseite mit {len(valid_names)} Kunden erstellt " success = (f"✅ Willkommensseite mit {len(valid_names)} Kunden erstellt "
f"– angezeigt auf: {', '.join(targets)}") f"– angezeigt auf: {', '.join(targets)}")
if valid_until: if valid_until: