This commit is contained in:
Chris Mann 2023-07-23 13:12:59 +02:00
parent dd6f84d25b
commit 345ddb2031
2 changed files with 7 additions and 2 deletions

View file

@ -93,6 +93,9 @@ func passwordFound(user User, config *ConfigFile, ldapConn *ldap.Conn) (bool, er
}
err = l.Bind(user.DN, user.Password)
if err != nil {
log.Printf(fmt.Sprint("passwordFound %v", err))
log.Printf(fmt.Sprint("passwordFound %v", user.DN))
log.Printf(fmt.Sprint("passwordFound %v", user.UID))
return false, err
}
return true, nil

View file

@ -135,17 +135,19 @@ func handleFoundPassword(w http.ResponseWriter, r *http.Request) {
newCode, _ := b64.URLEncoding.DecodeString(code)
ldapConn, err := openNewUserLdap(config)
if err != nil {
log.Printf(fmt.Sprint("handleFoundPassword %v", err))
log.Printf(fmt.Sprint("handleFoundPassword / openNewUserLdap / %v", err))
data.ErrorMessage = err.Error()
}
codeArray := strings.Split(string(newCode), ";")
user := User{
UID: codeArray[0],
Password: codeArray[1],
DN: "uid=" + codeArray[0] + ",ou=invitations,dc=resdigita,dc=org",
}
data.Success, err = passwordFound(user, config, ldapConn)
if err != nil {
log.Printf(fmt.Sprint("handleFoundPassword %v", err))
log.Printf(fmt.Sprint("handleFoundPassword / passwordFound %v", err))
log.Printf(fmt.Sprint("handleFoundPassword / passwordFound %user", err))
data.ErrorMessage = err.Error()
}
templateFoundPasswordPage.Execute(w, data)