G Pas
This commit is contained in:
parent
64ab2160fa
commit
eb6410fa08
2 changed files with 9 additions and 4 deletions
6
gpas.go
6
gpas.go
|
@ -34,7 +34,7 @@ func passwordLost(user User, config *ConfigFile, ldapConn *ldap.Conn) error {
|
||||||
}
|
}
|
||||||
searchFilter := "(|"
|
searchFilter := "(|"
|
||||||
if user.CN != "" {
|
if user.CN != "" {
|
||||||
searchFilter += "(cn=" + user.CN + ")"
|
searchFilter += "(cn=" + user.UID + ")"
|
||||||
}
|
}
|
||||||
if user.Mail != "" {
|
if user.Mail != "" {
|
||||||
searchFilter += "(mail=" + user.Mail + ")"
|
searchFilter += "(mail=" + user.Mail + ")"
|
||||||
|
@ -57,6 +57,10 @@ func passwordLost(user User, config *ConfigFile, ldapConn *ldap.Conn) error {
|
||||||
}
|
}
|
||||||
log.Printf(fmt.Sprintf("passwordLost : %v", user))
|
log.Printf(fmt.Sprintf("passwordLost : %v", user))
|
||||||
log.Printf(fmt.Sprintf("passwordLost : %v", searchRes.Entries[0]))
|
log.Printf(fmt.Sprintf("passwordLost : %v", searchRes.Entries[0]))
|
||||||
|
log.Printf(fmt.Sprintf("passwordLost : %v", searchRes.Entries[0].GetAttributeValue("cn")))
|
||||||
|
log.Printf(fmt.Sprintf("passwordLost : %v", searchRes.Entries[0].GetAttributeValue("uid")))
|
||||||
|
log.Printf(fmt.Sprintf("passwordLost : %v", searchRes.Entries[0].GetAttributeValue("mail")))
|
||||||
|
log.Printf(fmt.Sprintf("passwordLost : %v", searchRes.Entries[0].GetAttributeValue("carLicense")))
|
||||||
// Préparation du courriel à envoyer
|
// Préparation du courriel à envoyer
|
||||||
user.Password = suggestPassword()
|
user.Password = suggestPassword()
|
||||||
code := b64.URLEncoding.EncodeToString([]byte(user.UID + ";" + user.Password))
|
code := b64.URLEncoding.EncodeToString([]byte(user.UID + ";" + user.Password))
|
||||||
|
|
|
@ -82,9 +82,10 @@ func handleLostPassword(w http.ResponseWriter, r *http.Request) {
|
||||||
data.Mail = strings.TrimSpace(strings.Join(r.Form["mail"], ""))
|
data.Mail = strings.TrimSpace(strings.Join(r.Form["mail"], ""))
|
||||||
data.OtherMailbox = strings.TrimSpace(strings.Join(r.Form["othermailbox"], ""))
|
data.OtherMailbox = strings.TrimSpace(strings.Join(r.Form["othermailbox"], ""))
|
||||||
user := User{
|
user := User{
|
||||||
CN: data.Username,
|
CN: strings.TrimSpace(strings.Join(r.Form["username"], "")),
|
||||||
Mail: data.Mail,
|
UID: strings.TrimSpace(strings.Join(r.Form["username"], "")),
|
||||||
OtherMailbox: data.OtherMailbox,
|
Mail: strings.TrimSpace(strings.Join(r.Form["mail"], "")),
|
||||||
|
OtherMailbox: strings.TrimSpace(strings.Join(r.Form["othermailbox"], "")),
|
||||||
}
|
}
|
||||||
ldapConn, err := openNewUserLdap(config)
|
ldapConn, err := openNewUserLdap(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue