Impostazioni: durata loop, tolleranze, anagrafiche; tab Utenti con reset password (#47 #48 #49 #50 #51)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-07 12:28:31 +02:00
parent a829bf3eb0
commit 23bfc93f1c
9 changed files with 592 additions and 244 deletions
+17 -15
View File
@@ -29,28 +29,30 @@ def admin_required(f):
@login_required
@admin_required
def user_list():
"""User management page."""
resp = api_client.get("/api/users")
if isinstance(resp, dict) and resp.get("error"):
flash(_("Errore nel caricamento degli utenti: %(error)s", error=resp.get("detail", "")), "error")
users = []
elif isinstance(resp, list):
users = resp
else:
users = []
return render_template("admin/users.html", users=users)
"""#50: la gestione utenti vive nella tab «Utenti» di Impostazioni."""
return redirect(url_for("admin.settings_page", tab="utenti"))
@admin_bp.route("/settings")
@login_required
@admin_required
def settings_page():
"""System settings page."""
"""System settings page (admin only), con la tab «Utenti» (#50)."""
resp = api_client.get("/api/settings")
settings = resp if not isinstance(resp, dict) or not resp.get("error") else {}
return render_template("admin/settings.html", settings=settings)
# Solo un dict valido sono impostazioni: un errore o altro tipo = nessuna
settings = resp if isinstance(resp, dict) and not resp.get("error") else {}
users_resp = api_client.get("/api/users")
if isinstance(users_resp, dict) and users_resp.get("error"):
flash(_("Errore nel caricamento degli utenti: %(error)s", error=users_resp.get("detail", "")), "error")
users = []
elif isinstance(users_resp, list):
users = users_resp
else:
users = []
tab = "utenti" if request.args.get("tab") == "utenti" else "generale"
return render_template("admin/settings.html", settings=settings, users=users, active_tab=tab)
@admin_bp.route("/api/settings", methods=["PUT"])