Refactoring
This commit is contained in:
parent
9b04e88b72
commit
75f4a17c3f
2 changed files with 13 additions and 12 deletions
|
@ -39,17 +39,18 @@ func get(user User, config *ConfigFile, ldapConn *ldap.Conn) (*User, error) {
|
|||
}
|
||||
userEntry := searchRes.Entries[0]
|
||||
resUser := User{
|
||||
DN: user.DN,
|
||||
GivenName: searchRes.Entries[0].GetAttributeValue("givenName"),
|
||||
DisplayName: searchRes.Entries[0].GetAttributeValue("displayName"),
|
||||
Description: searchRes.Entries[0].GetAttributeValue("description"),
|
||||
SN: searchRes.Entries[0].GetAttributeValue("sn"),
|
||||
UID: searchRes.Entries[0].GetAttributeValue("uid"),
|
||||
CN: searchRes.Entries[0].GetAttributeValue("cn"),
|
||||
Mail: searchRes.Entries[0].GetAttributeValue("mail"),
|
||||
CanAdmin: strings.EqualFold(user.DN, config.AdminAccount),
|
||||
CanInvite: true,
|
||||
UserEntry: userEntry,
|
||||
DN: user.DN,
|
||||
GivenName: searchRes.Entries[0].GetAttributeValue("givenName"),
|
||||
DisplayName: searchRes.Entries[0].GetAttributeValue("displayName"),
|
||||
Description: searchRes.Entries[0].GetAttributeValue("description"),
|
||||
SN: searchRes.Entries[0].GetAttributeValue("sn"),
|
||||
UID: searchRes.Entries[0].GetAttributeValue("uid"),
|
||||
CN: searchRes.Entries[0].GetAttributeValue("cn"),
|
||||
Mail: searchRes.Entries[0].GetAttributeValue("mail"),
|
||||
OtherMailbox: searchRes.Entries[0].GetAttributeValue("carLicense"),
|
||||
CanAdmin: strings.EqualFold(user.DN, config.AdminAccount),
|
||||
CanInvite: true,
|
||||
UserEntry: userEntry,
|
||||
}
|
||||
searchReq.BaseDN = config.GroupCanAdmin
|
||||
searchReq.Filter = "(member=" + user.DN + ")"
|
||||
|
|
2
utils.go
2
utils.go
|
@ -61,7 +61,7 @@ func sendMail(sendMailTplData SendMailTplData) error {
|
|||
message := buf.Bytes()
|
||||
auth := smtp.PlainAuth("", config.SMTPUsername, config.SMTPPassword, config.SMTPServer)
|
||||
log.Printf("auth: %v", auth)
|
||||
err = smtp.SendMail(config.SMTPServer+":587", auth, config.SMTPUsername, []string{user.OtherMailbox}, message)
|
||||
err = smtp.SendMail(config.SMTPServer+":587", auth, config.SMTPUsername, []string{sendMailTplData.To}, message)
|
||||
if err != nil {
|
||||
log.Printf("email send error %v", err)
|
||||
return err
|
||||
|
|
Loading…
Reference in a new issue