Ansible schedule form: structured playbook-variable fields + first-item dropdown defaults #2

Merged
bvandeusen merged 126 commits from dev into main 2026-06-30 23:44:04 -04:00
2 changed files with 22 additions and 1 deletions
Showing only changes of commit f80f6c87e8 - Show all commits
+11 -1
View File
@@ -184,7 +184,10 @@ async def setup():
from quart import current_app
if await get_user_count(current_app) > 0:
return redirect(url_for("auth.login"))
return await render_template("auth/setup.html")
# Pre-fill the public URL with however the operator reached this page — the
# common case is correct, and it's what agent installs / share links use.
return await render_template(
"auth/setup.html", default_url=request.host_url.rstrip("/"))
@auth_bp.post("/setup")
@@ -201,9 +204,16 @@ async def setup_post():
return await render_template("auth/setup.html", error="All fields required"), 400
pw_hash = bcrypt.hashpw(password, bcrypt.gensalt()).decode()
user = User(username=username, email=email, password_hash=pw_hash, role=UserRole.admin)
steward_url = (form.get("public_base_url", "") or "").strip().rstrip("/")
async with current_app.db_sessionmaker() as db:
async with db.begin():
db.add(user)
if steward_url:
from steward.core.settings import set_setting
await set_setting(db, "general.public_base_url", steward_url)
if steward_url:
# Apply immediately so agent installs / share links use it without a restart.
current_app.config["PUBLIC_BASE_URL"] = steward_url
login_user(user)
await log_audit(current_app, user.id, user.username, "auth.setup",
detail={"username": username})
+11
View File
@@ -18,6 +18,17 @@
<label>Password</label>
<input type="password" name="password" required>
</div>
<div class="form-group">
<label>Steward URL
<span style="color:var(--text-muted);font-weight:normal;font-size:0.78rem;">(how hosts & browsers reach this server)</span>
</label>
<input type="text" name="public_base_url" value="{{ default_url or '' }}"
placeholder="https://steward.example.com">
<span style="color:var(--text-muted);font-size:0.78rem;">
Used for agent installs, share links, and alert links. Pre-filled from your current
address — change it if hosts reach Steward by a different name. Editable later in Settings → General.
</span>
</div>
<button type="submit" class="btn">Create Admin Account</button>
</form>
</div>