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", 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)
|
||||
|
|
|
@ -100,6 +100,10 @@ func handleLostPassword(w http.ResponseWriter, r *http.Request) {
|
|||
data.ErrorMessage = err.Error()
|
||||
}
|
||||
err = passwordLost(user, config, ldapConn)
|
||||
if err != nil {
|
||||
log.Printf(fmt.Sprintf("handleLostPassword : %v %v", err, ldapConn))
|
||||
data.ErrorMessage = err.Error()
|
||||
} else {
|
||||
err = ldapConn.Bind(config.NewUserDN, config.NewUserPassword)
|
||||
if err != nil {
|
||||
log.Printf(fmt.Sprintf("handleLostPassword : %v %v", err, ldapConn))
|
||||
|
@ -108,6 +112,7 @@ func handleLostPassword(w http.ResponseWriter, r *http.Request) {
|
|||
data.Success = true
|
||||
}
|
||||
}
|
||||
}
|
||||
data.CanAdmin = false
|
||||
templateLostPasswordPage.Execute(w, data)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue