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))
|
||||
return err
|
||||
}
|
||||
if len(searchRes.Entries) == 0 {
|
||||
/* Add the invitation */
|
||||
addReq := ldap.NewAddRequest(
|
||||
"uid="+user.CN+","+config.InvitationBaseDN,
|
||||
nil)
|
||||
addReq.Attribute("objectClass", []string{"top", "account", "simpleSecurityObject"})
|
||||
addReq.Attribute("uid", []string{user.CN})
|
||||
addReq.Attribute("userPassword", []string{suggestPassword()})
|
||||
addReq.Attribute("seeAlso", []string{config.UserNameAttr + "=" + user.UID + "," + config.InvitationBaseDN})
|
||||
err = ldapConn.Add(addReq)
|
||||
if err != nil {
|
||||
log.Printf("passwordLost 83 : %v", err)
|
||||
log.Printf("passwordLost 84 : %v", user)
|
||||
// // log.Printf("passwordLost 85 : %v", searchRes.Entries[0]))
|
||||
// // For some reason I get here even if the entry exists already
|
||||
return err
|
||||
}
|
||||
// if len(searchRes.Entries) == 0 {
|
||||
/* Add the invitation */
|
||||
addReq := ldap.NewAddRequest(
|
||||
"uid="+user.UID+","+config.InvitationBaseDN,
|
||||
nil)
|
||||
addReq.Attribute("objectClass", []string{"top", "account", "simpleSecurityObject"})
|
||||
addReq.Attribute("uid", []string{user.UID})
|
||||
addReq.Attribute("userPassword", []string{suggestPassword()})
|
||||
addReq.Attribute("seeAlso", []string{config.UserNameAttr + "=" + user.UID + "," + config.InvitationBaseDN})
|
||||
err = ldapConn.Add(addReq)
|
||||
if err != nil {
|
||||
log.Printf("passwordLost 83 : %v", err)
|
||||
log.Printf("passwordLost 84 : %v", user)
|
||||
// // log.Printf("passwordLost 85 : %v", searchRes.Entries[0]))
|
||||
// // For some reason I get here even if the entry exists already
|
||||
// return err
|
||||
}
|
||||
// }
|
||||
ldapNewConn, err := openNewUserLdap(config)
|
||||
if err != nil {
|
||||
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.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)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue