Fixed Change Password Bug
This commit is contained in:
parent
933c97f585
commit
7449ff3feb
2 changed files with 8 additions and 3 deletions
2
gpas.go
2
gpas.go
|
@ -49,7 +49,7 @@ func passwordLost(user User, config *ConfigFile, ldapConn *ldap.Conn) error {
|
||||||
log.Printf(fmt.Sprintf("passwordLost : %v %v", err, ldapConn))
|
log.Printf(fmt.Sprintf("passwordLost : %v %v", err, ldapConn))
|
||||||
log.Printf(fmt.Sprintf("passwordLost : %v", searchReq))
|
log.Printf(fmt.Sprintf("passwordLost : %v", searchReq))
|
||||||
log.Printf(fmt.Sprintf("passwordLost : %v", user))
|
log.Printf(fmt.Sprintf("passwordLost : %v", user))
|
||||||
return errors.New("Chose LDAP")
|
return err
|
||||||
}
|
}
|
||||||
if len(searchRes.Entries) == 0 {
|
if len(searchRes.Entries) == 0 {
|
||||||
log.Printf("Il n'y a pas d'utilisateur qui correspond %v", searchReq)
|
log.Printf("Il n'y a pas d'utilisateur qui correspond %v", searchReq)
|
||||||
|
|
|
@ -100,12 +100,17 @@ func handleLostPassword(w http.ResponseWriter, r *http.Request) {
|
||||||
data.ErrorMessage = err.Error()
|
data.ErrorMessage = err.Error()
|
||||||
}
|
}
|
||||||
err = passwordLost(user, config, ldapConn)
|
err = passwordLost(user, config, ldapConn)
|
||||||
err = ldapConn.Bind(config.NewUserDN, config.NewUserPassword)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf(fmt.Sprintf("handleLostPassword : %v %v", err, ldapConn))
|
log.Printf(fmt.Sprintf("handleLostPassword : %v %v", err, ldapConn))
|
||||||
data.ErrorMessage = err.Error()
|
data.ErrorMessage = err.Error()
|
||||||
} else {
|
} else {
|
||||||
data.Success = true
|
err = ldapConn.Bind(config.NewUserDN, config.NewUserPassword)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf(fmt.Sprintf("handleLostPassword : %v %v", err, ldapConn))
|
||||||
|
data.ErrorMessage = err.Error()
|
||||||
|
} else {
|
||||||
|
data.Success = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data.CanAdmin = false
|
data.CanAdmin = false
|
||||||
|
|
Loading…
Reference in a new issue