(_ *macaron.Context, u User, tpl, code, subject, info string)
| 100 | } |
| 101 | |
| 102 | func SendUserMail(_ *macaron.Context, u User, tpl, code, subject, info string) { |
| 103 | data := map[string]any{ |
| 104 | "Username": u.DisplayName(), |
| 105 | "ActiveCodeLives": conf.Auth.ActivateCodeLives / 60, |
| 106 | "ResetPwdCodeLives": conf.Auth.ResetPasswordCodeLives / 60, |
| 107 | "Code": code, |
| 108 | } |
| 109 | body, err := render(tpl, data) |
| 110 | if err != nil { |
| 111 | log.Error("render: %v", err) |
| 112 | return |
| 113 | } |
| 114 | |
| 115 | msg := NewMessage([]string{u.Email()}, subject, body) |
| 116 | msg.Info = fmt.Sprintf("UID: %d, %s", u.ID(), info) |
| 117 | |
| 118 | Send(msg) |
| 119 | } |
| 120 | |
| 121 | func SendActivateAccountMail(c *macaron.Context, u User) { |
| 122 | SendUserMail(c, u, tmplAuthActivate, u.GenerateEmailActivateCode(u.Email()), c.Tr("mail.activate_account"), "activate account") |
no test coverage detected