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,11 +59,13 @@ 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
err := modify(user, config, login.conn) if user.Mail != "" {
if err != nil { err := modify(user, config, login.conn)
data.ErrorMessage = "handleProfile : " + err.Error() if err != nil {
} else { data.ErrorMessage = "handleProfile : " + err.Error()
data.Success = true } else {
data.Success = true
}
} }
/* /*