From 8e5f01754f26f34f074b21346b6908db3b4ba19c Mon Sep 17 00:00:00 2001 From: "Aaron D. Lee" Date: Sun, 4 Jan 2026 00:10:48 -0500 Subject: [PATCH] Improve user creation UX with modal dialog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replace redirect flow with AJAX + modal popup - Show credentials side-by-side (username | password) - Compact warning message and right-aligned action buttons - Add Another resets form, Done returns to user list - Narrow flash messages to match card width 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- frontends/web/app.py | 10 +- frontends/web/templates/admin/user_new.html | 108 +++++++++++++++++++- frontends/web/templates/base.html | 18 ++-- 3 files changed, 124 insertions(+), 12 deletions(-) diff --git a/frontends/web/app.py b/frontends/web/app.py index b0da964..9e450b9 100644 --- a/frontends/web/app.py +++ b/frontends/web/app.py @@ -1552,9 +1552,17 @@ def admin_user_new(): password = request.form.get("password", "") success, message, user = create_user(username, password) + + # Check if AJAX request + if request.headers.get("X-Requested-With") == "XMLHttpRequest": + if success: + return jsonify({"success": True, "username": username, "password": password}) + else: + return jsonify({"success": False, "error": message}) + + # Regular form submission fallback if success: flash(f"User '{username}' created successfully", "success") - # Store password temporarily for display session["temp_password"] = password session["temp_username"] = username return redirect(url_for("admin_user_created")) diff --git a/frontends/web/templates/admin/user_new.html b/frontends/web/templates/admin/user_new.html index 84da57d..905bc3f 100644 --- a/frontends/web/templates/admin/user_new.html +++ b/frontends/web/templates/admin/user_new.html @@ -11,12 +11,12 @@ Add New User
-
+
-
+
+
- @@ -57,8 +59,108 @@
+ + + {% endblock %} {% block scripts %} + {% endblock %} diff --git a/frontends/web/templates/base.html b/frontends/web/templates/base.html index d096f9e..7408ad7 100644 --- a/frontends/web/templates/base.html +++ b/frontends/web/templates/base.html @@ -67,16 +67,18 @@
{% with messages = get_flashed_messages(with_categories=true) %} {% if messages %} - {% for category, message in messages %} - - {% endfor %} +
+ {% for category, message in messages %} + + {% endfor %} +
{% endif %} {% endwith %} - + {% block content %}{% endblock %}