Add ui_host variable to form in wizard

This commit is contained in:
Théophile Diot 2023-12-01 10:11:37 +01:00
parent 700b434f4d
commit 35bfda5b32
No known key found for this signature in database
GPG key ID: 248FEA4BAE400D06
2 changed files with 11 additions and 5 deletions

View file

@ -359,6 +359,8 @@ def setup():
return redirect(url_for("home"))
return redirect(url_for("login"), 301)
db_config = app.config["CONFIG"].get_config(methods=False)
if request.method == "POST":
if not request.form:
flash("Missing form data.", "error")
@ -382,8 +384,6 @@ def setup():
flash("The admin password is not strong enough. It must contain at least 8 characters, including at least 1 uppercase letter, 1 lowercase letter, 1 number and 1 special character (#@?!$%^&*-).", "error")
error = True
db_config = app.config["CONFIG"].get_config(methods=False)
server_names = db_config["SERVER_NAME"].split(" ")
if request.form["server_name"] in server_names:
flash(f"The hostname {request.form['server_name']} is already in use.", "error")
@ -435,7 +435,13 @@ def setup():
return redirect(url_for("loading", next=url_for("services"), message=f"Creating service {request.form['server_name']} for the web UI"))
return render_template("setup.html", username=getenv("ADMIN_USERNAME", ""), password=getenv("ADMIN_PASSWORD", ""), random_url=f"/{''.join(choice(ascii_letters + digits) for _ in range(10))}")
return render_template(
"setup.html",
username=getenv("ADMIN_USERNAME", ""),
password=getenv("ADMIN_PASSWORD", ""),
ui_host=db_config.get("UI_HOST", getenv("UI_HOST", "")),
random_url=f"/{''.join(choice(ascii_letters + digits) for _ in range(10))}",
)
@app.route("/home")

View file

@ -1456,9 +1456,9 @@
type="text"
id="ui_host"
name="ui_host"
value="UI_HOST"
value="{{ ui_host }}"
class="col-span-12 dark:border-slate-600 dark:bg-slate-700 dark:text-gray-300 disabled:opacity-75 focus:valid:border-green-500 focus:invalid:border-red-500 outline-none focus:border-primary text-sm leading-5.6 ease block w-full appearance-none rounded-lg border border-solid border-gray-300 bg-white bg-clip-padding px-4 py-2 font-normal text-gray-700 transition-all placeholder:text-gray-500"
placeholder="http://bw-ui:7000"
placeholder="http://[hostname](:[port])"
pattern="^https?:\/\/.{1,255}(:((6553[0-5])|(655[0-2][0-9])|(65[0-4][0-9]{2})|(6[0-4][0-9]{3})|([1-5][0-9]{4})|([0-5]{0,5})|([0-9]{1,4})))?$"
required
/>