diff --git a/gpas.go b/gpas.go index f27f305..8908f64 100644 --- a/gpas.go +++ b/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", searchReq)) log.Printf(fmt.Sprintf("passwordLost : %v", user)) - return errors.New("Chose LDAP") + return err } if len(searchRes.Entries) == 0 { log.Printf("Il n'y a pas d'utilisateur qui correspond %v", searchReq) diff --git a/invite.go b/invite.go index e0092fe..0b1db9a 100644 --- a/invite.go +++ b/invite.go @@ -100,12 +100,17 @@ func handleLostPassword(w http.ResponseWriter, r *http.Request) { data.ErrorMessage = err.Error() } err = passwordLost(user, config, ldapConn) - 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 + 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