Factoring the model user and correcting password

This commit is contained in:
Chris Mann 2023-07-22 09:49:09 +02:00
parent 4186942162
commit e247d4b434
2 changed files with 8 additions and 6 deletions

View file

@ -166,7 +166,7 @@ func replaceIfContent(modifReq *ldap.ModifyRequest, key string, value string, pr
if value != "" { if value != "" {
modifReq.Replace(key, []string{value}) modifReq.Replace(key, []string{value})
} else { } else {
modifReq.Delete(key, []string{value}) modifReq.Delete(key, []string{previousValue})
} }
return nil return nil
} }

View file

@ -59,12 +59,14 @@ func handleProfile(w http.ResponseWriter, r *http.Request) {
data.GivenName = user.GivenName data.GivenName = user.GivenName
data.Surname = user.SN data.Surname = user.SN
data.Description = user.Description data.Description = user.Description
if user.Mail != "" {
err := modify(user, config, login.conn) err := modify(user, config, login.conn)
if err != nil { if err != nil {
data.ErrorMessage = "handleProfile : " + err.Error() data.ErrorMessage = "handleProfile : " + err.Error()
} else { } else {
data.Success = true data.Success = true
} }
}
/* /*
visible := strings.TrimSpace(strings.Join(r.Form["visibility"], "")) visible := strings.TrimSpace(strings.Join(r.Form["visibility"], ""))