G Pas
This commit is contained in:
parent
dd6f84d25b
commit
345ddb2031
2 changed files with 7 additions and 2 deletions
3
gpas.go
3
gpas.go
|
@ -93,6 +93,9 @@ func passwordFound(user User, config *ConfigFile, ldapConn *ldap.Conn) (bool, er
|
||||||
}
|
}
|
||||||
err = l.Bind(user.DN, user.Password)
|
err = l.Bind(user.DN, user.Password)
|
||||||
if err != nil {
|
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 false, err
|
||||||
}
|
}
|
||||||
return true, nil
|
return true, nil
|
||||||
|
|
|
@ -135,17 +135,19 @@ func handleFoundPassword(w http.ResponseWriter, r *http.Request) {
|
||||||
newCode, _ := b64.URLEncoding.DecodeString(code)
|
newCode, _ := b64.URLEncoding.DecodeString(code)
|
||||||
ldapConn, err := openNewUserLdap(config)
|
ldapConn, err := openNewUserLdap(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf(fmt.Sprint("handleFoundPassword %v", err))
|
log.Printf(fmt.Sprint("handleFoundPassword / openNewUserLdap / %v", err))
|
||||||
data.ErrorMessage = err.Error()
|
data.ErrorMessage = err.Error()
|
||||||
}
|
}
|
||||||
codeArray := strings.Split(string(newCode), ";")
|
codeArray := strings.Split(string(newCode), ";")
|
||||||
user := User{
|
user := User{
|
||||||
UID: codeArray[0],
|
UID: codeArray[0],
|
||||||
Password: codeArray[1],
|
Password: codeArray[1],
|
||||||
|
DN: "uid=" + codeArray[0] + ",ou=invitations,dc=resdigita,dc=org",
|
||||||
}
|
}
|
||||||
data.Success, err = passwordFound(user, config, ldapConn)
|
data.Success, err = passwordFound(user, config, ldapConn)
|
||||||
if err != nil {
|
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()
|
data.ErrorMessage = err.Error()
|
||||||
}
|
}
|
||||||
templateFoundPasswordPage.Execute(w, data)
|
templateFoundPasswordPage.Execute(w, data)
|
||||||
|
|
Loading…
Reference in a new issue