form: functional "collect on sign-up" setting

was added without functionality by accident in a7aa3fd. This commit adds
the functionality in. Probably some other fixes too.
This commit is contained in:
Harvey Tindall
2025-11-27 17:53:01 +00:00
parent d7e4431bd8
commit 073772ad60
7 changed files with 47 additions and 25 deletions

View File

@@ -39,6 +39,7 @@ interface formWindow extends GlobalWindow {
userPageEnabled: boolean;
userPageAddress: string;
customSuccessCard: boolean;
collectEmail: boolean;
}
loadLangSelector("form");
@@ -171,7 +172,13 @@ const submitSpan = form.querySelector("span.submit") as HTMLSpanElement;
const submitText = submitSpan.textContent;
let usernameField = document.getElementById("create-username") as HTMLInputElement;
const emailField = document.getElementById("create-email") as HTMLInputElement;
if (!window.usernameEnabled) { usernameField.parentElement.remove(); usernameField = emailField; }
window.emailRequired &&= window.collectEmail;
if (!window.usernameEnabled) {
usernameField.parentElement.remove(); usernameField = emailField;
} else if (!window.collectEmail) {
emailField.parentElement.classList.add("unfocused");
emailField.value = "";
}
const passwordField = document.getElementById("create-password") as HTMLInputElement;
const rePasswordField = document.getElementById("create-reenter-password") as HTMLInputElement;