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 != "" {
modifReq.Replace(key, []string{value})
} else {
modifReq.Delete(key, []string{value})
modifReq.Delete(key, []string{previousValue})
}
return nil
}

View file

@ -59,11 +59,13 @@ func handleProfile(w http.ResponseWriter, r *http.Request) {
data.GivenName = user.GivenName
data.Surname = user.SN
data.Description = user.Description
err := modify(user, config, login.conn)
if err != nil {
data.ErrorMessage = "handleProfile : " + err.Error()
} else {
data.Success = true
if user.Mail != "" {
err := modify(user, config, login.conn)
if err != nil {
data.ErrorMessage = "handleProfile : " + err.Error()
} else {
data.Success = true
}
}
/*