From 2ae902aba20d896e77490d79371211761bd3d61f Mon Sep 17 00:00:00 2001 From: Chris Mann Date: Thu, 27 Jul 2023 12:51:00 +0200 Subject: [PATCH] Bug Fixing --- templates/user/new.html | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/templates/user/new.html b/templates/user/new.html index 1dde81c..ab86408 100644 --- a/templates/user/new.html +++ b/templates/user/new.html @@ -111,31 +111,29 @@ function changeGivenNameOrSurname () { givenname = document.getElementById("givenname"); surname = document.getElementById("surname"); displayname = document.getElementById("displayname"); - username = document.getElementById("username"); displayname.value = givenname.value + " " + surname.value changeDisplayname(); } function changeDisplayname () { - givenname = document.getElementById("givenname"); - surname = document.getElementById("surname"); displayname = document.getElementById("displayname"); username = document.getElementById("username"); username.value = displayname.value.toLowerCase().replace(/[^A-z0-9.-]/g, '').replace(/^[.-]/, '').replace(/[.-]$/, ''); changeUsername(); } function changeUsername () { - givenname = document.getElementById("givenname"); - surname = document.getElementById("surname"); - displayname = document.getElementById("displayname"); + changeDomain(); +} +function changeDomain () { username = document.getElementById("username"); - mail = document.getElementById("mail"); defaultdomain = document.getElementById("defaultdomain"); + mail = document.getElementById("mail"); mail.value = username.value + "@" + defaultdomain.value; } document.getElementById("givenname").addEventListener("change",changeGivenNameOrSurname); document.getElementById("surname").addEventListener("change",changeGivenNameOrSurname); document.getElementById("displayname").addEventListener("change",changeDisplayname); document.getElementById("username").addEventListener("change",changeUsername); +document.getElementById("defaultdomain").addEventListener("change",changeDomain); {{end}} {{end}} \ No newline at end of file