Working on signup workfow
This commit is contained in:
parent
dd911ca11b
commit
6c0ab5cd7b
2 changed files with 22 additions and 17 deletions
|
@ -79,24 +79,24 @@ func passwordLost(user User, config *ConfigFile, ldapConn *ldap.Conn) error {
|
||||||
log.Printf(fmt.Sprintf("passwordLost (Check existing invitation) : %v", user))
|
log.Printf(fmt.Sprintf("passwordLost (Check existing invitation) : %v", user))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if len(searchRes.Entries) == 0 {
|
// if len(searchRes.Entries) == 0 {
|
||||||
/* Add the invitation */
|
/* Add the invitation */
|
||||||
addReq := ldap.NewAddRequest(
|
addReq := ldap.NewAddRequest(
|
||||||
"uid="+user.CN+","+config.InvitationBaseDN,
|
"uid="+user.UID+","+config.InvitationBaseDN,
|
||||||
nil)
|
nil)
|
||||||
addReq.Attribute("objectClass", []string{"top", "account", "simpleSecurityObject"})
|
addReq.Attribute("objectClass", []string{"top", "account", "simpleSecurityObject"})
|
||||||
addReq.Attribute("uid", []string{user.CN})
|
addReq.Attribute("uid", []string{user.UID})
|
||||||
addReq.Attribute("userPassword", []string{suggestPassword()})
|
addReq.Attribute("userPassword", []string{suggestPassword()})
|
||||||
addReq.Attribute("seeAlso", []string{config.UserNameAttr + "=" + user.UID + "," + config.InvitationBaseDN})
|
addReq.Attribute("seeAlso", []string{config.UserNameAttr + "=" + user.UID + "," + config.InvitationBaseDN})
|
||||||
err = ldapConn.Add(addReq)
|
err = ldapConn.Add(addReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("passwordLost 83 : %v", err)
|
log.Printf("passwordLost 83 : %v", err)
|
||||||
log.Printf("passwordLost 84 : %v", user)
|
log.Printf("passwordLost 84 : %v", user)
|
||||||
// // log.Printf("passwordLost 85 : %v", searchRes.Entries[0]))
|
// // log.Printf("passwordLost 85 : %v", searchRes.Entries[0]))
|
||||||
// // For some reason I get here even if the entry exists already
|
// // For some reason I get here even if the entry exists already
|
||||||
return err
|
// return err
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// }
|
||||||
ldapNewConn, err := openNewUserLdap(config)
|
ldapNewConn, err := openNewUserLdap(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("passwordLost openNewUserLdap : %v", err)
|
log.Printf("passwordLost openNewUserLdap : %v", err)
|
||||||
|
|
|
@ -175,6 +175,11 @@ func handleNewAccount(w http.ResponseWriter, r *http.Request, l *ldap.Conn, invi
|
||||||
data.Common.Success = false
|
data.Common.Success = false
|
||||||
data.Common.ErrorMessage = err.Error()
|
data.Common.ErrorMessage = err.Error()
|
||||||
}
|
}
|
||||||
|
// err = passwordLost(newUser, config, l)
|
||||||
|
// if err != nil {
|
||||||
|
// data.Common.Success = false
|
||||||
|
// data.Common.ErrorMessage = err.Error()
|
||||||
|
// }
|
||||||
http.Redirect(w, r, "/user/wait", http.StatusFound)
|
http.Redirect(w, r, "/user/wait", http.StatusFound)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue