From 0caf79a96ad34212867d78ea722fa7d67e961749 Mon Sep 17 00:00:00 2001 From: Chris Mann Date: Thu, 20 Jul 2023 15:40:14 +0200 Subject: [PATCH] Front-End Stuff --- invite.go | 2 ++ static/javascript/lesgv.js | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/invite.go b/invite.go index 55b33f8..402fd50 100644 --- a/invite.go +++ b/invite.go @@ -142,9 +142,11 @@ func handleNewAccount(w http.ResponseWriter, r *http.Request, l *ldap.Conn, invi } else { newUser.Password = password2 data.Success = addNewUser(newUser, config, login) + http.Redirect(w, r, "/admin/ldap/"+newUser.DN, http.StatusFound) } // tryCreateAccount(l, data, password1, password2, invitedBy) + } templateInviteNewAccount.Execute(w, data) diff --git a/static/javascript/lesgv.js b/static/javascript/lesgv.js index 512a619..9c8d193 100644 --- a/static/javascript/lesgv.js +++ b/static/javascript/lesgv.js @@ -10,4 +10,17 @@ function addResDigitaOrgIdValue () { function addResDigitaOrgMail () { document.getElementById("idvalue").value = addResDigitaOrg("mail"); } -document.getElementById("idvalue").addEventListener("change",addResDigitaOrgIdValue); \ No newline at end of file +let idvalueInput = document.querySelector("#idvalue"); +if (idvalueInput != null) { + idvalueInput.addEventListener("change",addResDigitaOrgIdValue); +} + + +function changeUsername () { + username = document.getElementById("username"); + calcCn = document.getElementById("calc-cn"); + calcCn.innerText = "Login Name et Courriel seront : " + username.value.split("@")[0] + "@lesgv.com"; +} +if (document.getElementById("username") != null) { + document.getElementById("username").addEventListener("change",changeUsername); +}