Bug Fixing

This commit is contained in:
Chris Mann 2023-07-27 12:51:00 +02:00
parent 47fdaa0f84
commit 2ae902aba2

View file

@ -111,31 +111,29 @@ function changeGivenNameOrSurname () {
givenname = document.getElementById("givenname"); givenname = document.getElementById("givenname");
surname = document.getElementById("surname"); surname = document.getElementById("surname");
displayname = document.getElementById("displayname"); displayname = document.getElementById("displayname");
username = document.getElementById("username");
displayname.value = givenname.value + " " + surname.value displayname.value = givenname.value + " " + surname.value
changeDisplayname(); changeDisplayname();
} }
function changeDisplayname () { function changeDisplayname () {
givenname = document.getElementById("givenname");
surname = document.getElementById("surname");
displayname = document.getElementById("displayname"); displayname = document.getElementById("displayname");
username = document.getElementById("username"); username = document.getElementById("username");
username.value = displayname.value.toLowerCase().replace(/[^A-z0-9.-]/g, '').replace(/^[.-]/, '').replace(/[.-]$/, ''); username.value = displayname.value.toLowerCase().replace(/[^A-z0-9.-]/g, '').replace(/^[.-]/, '').replace(/[.-]$/, '');
changeUsername(); changeUsername();
} }
function changeUsername () { function changeUsername () {
givenname = document.getElementById("givenname"); changeDomain();
surname = document.getElementById("surname"); }
displayname = document.getElementById("displayname"); function changeDomain () {
username = document.getElementById("username"); username = document.getElementById("username");
mail = document.getElementById("mail");
defaultdomain = document.getElementById("defaultdomain"); defaultdomain = document.getElementById("defaultdomain");
mail = document.getElementById("mail");
mail.value = username.value + "@" + defaultdomain.value; mail.value = username.value + "@" + defaultdomain.value;
} }
document.getElementById("givenname").addEventListener("change",changeGivenNameOrSurname); document.getElementById("givenname").addEventListener("change",changeGivenNameOrSurname);
document.getElementById("surname").addEventListener("change",changeGivenNameOrSurname); document.getElementById("surname").addEventListener("change",changeGivenNameOrSurname);
document.getElementById("displayname").addEventListener("change",changeDisplayname); document.getElementById("displayname").addEventListener("change",changeDisplayname);
document.getElementById("username").addEventListener("change",changeUsername); document.getElementById("username").addEventListener("change",changeUsername);
document.getElementById("defaultdomain").addEventListener("change",changeDomain);
</script> </script>
{{end}} {{end}}
{{end}} {{end}}