Refactoring
This commit is contained in:
parent
9b04e88b72
commit
75f4a17c3f
2 changed files with 13 additions and 12 deletions
|
@ -47,6 +47,7 @@ func get(user User, config *ConfigFile, ldapConn *ldap.Conn) (*User, error) {
|
||||||
UID: searchRes.Entries[0].GetAttributeValue("uid"),
|
UID: searchRes.Entries[0].GetAttributeValue("uid"),
|
||||||
CN: searchRes.Entries[0].GetAttributeValue("cn"),
|
CN: searchRes.Entries[0].GetAttributeValue("cn"),
|
||||||
Mail: searchRes.Entries[0].GetAttributeValue("mail"),
|
Mail: searchRes.Entries[0].GetAttributeValue("mail"),
|
||||||
|
OtherMailbox: searchRes.Entries[0].GetAttributeValue("carLicense"),
|
||||||
CanAdmin: strings.EqualFold(user.DN, config.AdminAccount),
|
CanAdmin: strings.EqualFold(user.DN, config.AdminAccount),
|
||||||
CanInvite: true,
|
CanInvite: true,
|
||||||
UserEntry: userEntry,
|
UserEntry: userEntry,
|
||||||
|
|
2
utils.go
2
utils.go
|
@ -61,7 +61,7 @@ func sendMail(sendMailTplData SendMailTplData) error {
|
||||||
message := buf.Bytes()
|
message := buf.Bytes()
|
||||||
auth := smtp.PlainAuth("", config.SMTPUsername, config.SMTPPassword, config.SMTPServer)
|
auth := smtp.PlainAuth("", config.SMTPUsername, config.SMTPPassword, config.SMTPServer)
|
||||||
log.Printf("auth: %v", auth)
|
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 {
|
if err != nil {
|
||||||
log.Printf("email send error %v", err)
|
log.Printf("email send error %v", err)
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in a new issue