Trying a utility file

This commit is contained in:
Chris Mann 2023-07-20 14:04:35 +02:00
parent 4b367f0b42
commit 93d0744f92

View file

@ -123,6 +123,7 @@ func handleNewAccount(w http.ResponseWriter, r *http.Request, l *ldap.Conn, invi
r.ParseForm() r.ParseForm()
newUser := NewUser{} newUser := NewUser{}
login := checkLogin(w, r)
newUser.CN = strings.TrimSpace(strings.Join(r.Form["username"], "@lesgv.com")) newUser.CN = strings.TrimSpace(strings.Join(r.Form["username"], "@lesgv.com"))
newUser.DisplayName = strings.TrimSpace(strings.Join(r.Form["displayname"], "")) 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"], "") password1 := strings.Join(r.Form["password"], "")
password2 := strings.Join(r.Form["password2"], "") 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) templateInviteNewAccount.Execute(w, data)