Factoring the model user and correcting password
This commit is contained in:
parent
4186942162
commit
e247d4b434
2 changed files with 8 additions and 6 deletions
|
@ -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
|
||||
}
|
||||
|
|
12
profile.go
12
profile.go
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue