Factoring the model user and correcting password

This commit is contained in:
Chris Mann 2023-07-22 13:42:50 +02:00
parent 589984cb96
commit eeba767453

View file

@ -157,7 +157,7 @@ func handleNewAccount(w http.ResponseWriter, r *http.Request, l *ldap.Conn, invi
newUser.SN = strings.TrimSpace(strings.Join(r.Form["surname"], "")) newUser.SN = strings.TrimSpace(strings.Join(r.Form["surname"], ""))
newUser.Mail = strings.TrimSpace(strings.Join(r.Form["mail"], "")) newUser.Mail = strings.TrimSpace(strings.Join(r.Form["mail"], ""))
newUser.UID = strings.TrimSpace(strings.Join(r.Form["username"], "")) newUser.UID = strings.TrimSpace(strings.Join(r.Form["username"], ""))
newUser.CN = strings.TrimSpace(strings.Join(r.Form["otherMailbox"], "")) newUser.CN = strings.TrimSpace(strings.Join(r.Form["CN"], ""))
newUser.DN = "cn=" + newUser.CN + "," + config.InvitationBaseDN newUser.DN = "cn=" + newUser.CN + "," + config.InvitationBaseDN
password1 := strings.Join(r.Form["password"], "") password1 := strings.Join(r.Form["password"], "")
@ -174,7 +174,7 @@ func handleNewAccount(w http.ResponseWriter, r *http.Request, l *ldap.Conn, invi
data.Success = false data.Success = false
data.ErrorMessage = err.Error() data.ErrorMessage = err.Error()
} }
http.Redirect(w, r, "/admin/ldap/"+newUser.DN, http.StatusFound) http.Redirect(w, r, "/admin/activate", http.StatusFound)
} }
// tryCreateAccount(l, data, password1, password2, invitedBy) // tryCreateAccount(l, data, password1, password2, invitedBy)