From 93d0744f927563f9122b1a7e5dfe17b2b583c6f3 Mon Sep 17 00:00:00 2001 From: Chris Mann Date: Thu, 20 Jul 2023 14:04:35 +0200 Subject: [PATCH] Trying a utility file --- invite.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/invite.go b/invite.go index 22f3e42..6452b4f 100644 --- a/invite.go +++ b/invite.go @@ -123,6 +123,7 @@ func handleNewAccount(w http.ResponseWriter, r *http.Request, l *ldap.Conn, invi r.ParseForm() newUser := NewUser{} + login := checkLogin(w, r) newUser.CN = strings.TrimSpace(strings.Join(r.Form["username"], "@lesgv.com")) newUser.DisplayName = strings.TrimSpace(strings.Join(r.Form["displayname"], "")) @@ -134,7 +135,15 @@ func handleNewAccount(w http.ResponseWriter, r *http.Request, l *ldap.Conn, invi password1 := strings.Join(r.Form["password"], "") password2 := strings.Join(r.Form["password2"], "") - tryCreateAccount(l, data, password1, password2, invitedBy) + if password1 == password2 { + data.Success = false + data.ErrorPasswordMismatch = true + } else { + newUser.Password = password2 + addNewUser(newUser, config, login) + } + + // tryCreateAccount(l, data, password1, password2, invitedBy) } templateInviteNewAccount.Execute(w, data)