Fixed Change Password Bug
This commit is contained in:
parent
a291232fd8
commit
53a92e2f5c
1 changed files with 24 additions and 12 deletions
12
gpas.go
12
gpas.go
|
@ -69,6 +69,17 @@ func passwordLost(user User, config *ConfigFile, ldapConn *ldap.Conn) error {
|
|||
user.CN = searchRes.Entries[0].GetAttributeValue("cn")
|
||||
user.Mail = searchRes.Entries[0].GetAttributeValue("mail")
|
||||
user.OtherMailbox = searchRes.Entries[0].GetAttributeValue("carLicense")
|
||||
/* Check for outstanding invitation */
|
||||
searchReq = ldap.NewSearchRequest(user.DN, ldap.ScopeBaseObject,
|
||||
ldap.NeverDerefAliases, 0, 0, false, "(uid="+user.UID+")", []string{"seeAlso"}, nil)
|
||||
searchRes, err = ldapConn.Search(searchReq)
|
||||
if err != nil {
|
||||
log.Printf(fmt.Sprintf("passwordLost (Check existing invitation) : %v", err))
|
||||
log.Printf(fmt.Sprintf("passwordLost (Check existing invitation) : %v", user))
|
||||
log.Printf(fmt.Sprintf("passwordLost (Check existing invitation) : %v", searchRes.Entries[0]))
|
||||
return err
|
||||
}
|
||||
if len(searchRes.Entries == 0) {
|
||||
/* Add the invitation */
|
||||
addReq := ldap.NewAddRequest(
|
||||
user.DN,
|
||||
|
@ -84,6 +95,7 @@ func passwordLost(user User, config *ConfigFile, ldapConn *ldap.Conn) error {
|
|||
log.Printf(fmt.Sprintf("passwordLost 85 : %v", searchRes.Entries[0]))
|
||||
return err
|
||||
}
|
||||
}
|
||||
err = passwd(user, config, ldapConn)
|
||||
if err != nil {
|
||||
log.Printf(fmt.Sprintf("passwordLost 90 : %v", err))
|
||||
|
|
Loading…
Reference in a new issue