Refactoring

This commit is contained in:
Chris Mann 2023-07-26 10:51:59 +02:00
parent 9b04e88b72
commit 75f4a17c3f
2 changed files with 13 additions and 12 deletions

View file

@ -47,6 +47,7 @@ func get(user User, config *ConfigFile, ldapConn *ldap.Conn) (*User, error) {
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,

View file

@ -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