diff --git a/gpas.go b/gpas.go index 4d6fc63..55e0797 100644 --- a/gpas.go +++ b/gpas.go @@ -24,13 +24,13 @@ func passwordLost(user User, config *ConfigFile, ldapConn *ldap.Conn) error { return errors.New("Il n'y a pas de quoi identifier l'utilisateur") } searchFilter := "(|" - if user.CN == "" { + if user.CN != "" { searchFilter += "(cn=" + user.CN + ")" } - if user.Mail == "" { + if user.Mail != "" { searchFilter += "(mail=" + user.Mail + ")" } - if user.OtherMailbox == "" { + if user.OtherMailbox != "" { searchFilter += "(carLicense=" + user.OtherMailbox + ")" } searchFilter += ")" diff --git a/invite.go b/invite.go index 172c053..9fbb3da 100644 --- a/invite.go +++ b/invite.go @@ -48,11 +48,7 @@ type LostPasswordData struct { func handleLostPassword(w http.ResponseWriter, r *http.Request) { templateLostPasswordPage := getTemplate("lost_password.html") - data := LostPasswordData{ - Username: "", - Mail: "", - OtherMailbox: "", - } + data := LostPasswordData{} l, err := ldapOpen(w) if err != nil { log.Printf(fmt.Sprintf("handleLostPassword : %v %v", err, l))