This commit is contained in:
Chris Mann 2023-07-23 09:35:32 +02:00
parent 4f6ed7f47a
commit a3732c504b
2 changed files with 4 additions and 8 deletions

View file

@ -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") return errors.New("Il n'y a pas de quoi identifier l'utilisateur")
} }
searchFilter := "(|" searchFilter := "(|"
if user.CN == "" { if user.CN != "" {
searchFilter += "(cn=" + user.CN + ")" searchFilter += "(cn=" + user.CN + ")"
} }
if user.Mail == "" { if user.Mail != "" {
searchFilter += "(mail=" + user.Mail + ")" searchFilter += "(mail=" + user.Mail + ")"
} }
if user.OtherMailbox == "" { if user.OtherMailbox != "" {
searchFilter += "(carLicense=" + user.OtherMailbox + ")" searchFilter += "(carLicense=" + user.OtherMailbox + ")"
} }
searchFilter += ")" searchFilter += ")"

View file

@ -48,11 +48,7 @@ type LostPasswordData struct {
func handleLostPassword(w http.ResponseWriter, r *http.Request) { func handleLostPassword(w http.ResponseWriter, r *http.Request) {
templateLostPasswordPage := getTemplate("lost_password.html") templateLostPasswordPage := getTemplate("lost_password.html")
data := LostPasswordData{ data := LostPasswordData{}
Username: "",
Mail: "",
OtherMailbox: "",
}
l, err := ldapOpen(w) l, err := ldapOpen(w)
if err != nil { if err != nil {
log.Printf(fmt.Sprintf("handleLostPassword : %v %v", err, l)) log.Printf(fmt.Sprintf("handleLostPassword : %v %v", err, l))