mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
#1525 Triggere mailer for admin created accounts
This commit is contained in:
@@ -17,10 +17,10 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
AUTH_ACTIVATE base.TplName = "mail/auth/activate"
|
||||
AUTH_ACTIVATE_EMAIL base.TplName = "mail/auth/activate_email"
|
||||
AUTH_RESET_PASSWORD base.TplName = "mail/auth/reset_passwd"
|
||||
AUTH_REGISTER_SUCCESS base.TplName = "mail/auth/register_success"
|
||||
AUTH_ACTIVATE base.TplName = "mail/auth/activate"
|
||||
AUTH_ACTIVATE_EMAIL base.TplName = "mail/auth/activate_email"
|
||||
AUTH_REGISTER_NOTIFY base.TplName = "mail/auth/register_notify"
|
||||
AUTH_RESET_PASSWORD base.TplName = "mail/auth/reset_passwd"
|
||||
|
||||
NOTIFY_COLLABORATOR base.TplName = "mail/notify/collaborator"
|
||||
NOTIFY_MENTION base.TplName = "mail/notify/mention"
|
||||
@@ -64,6 +64,20 @@ func SendResetPasswordMail(c *macaron.Context, u *models.User) {
|
||||
SendUserMail(c, u, AUTH_RESET_PASSWORD, u.GenerateActivateCode(), c.Tr("mail.reset_password"), "reset password")
|
||||
}
|
||||
|
||||
// SendRegisterNotifyMail triggers a notify e-mail by admin created a account.
|
||||
func SendRegisterNotifyMail(c *macaron.Context, u *models.User) {
|
||||
body, err := c.HTMLString(string(AUTH_REGISTER_NOTIFY), ComposeTplData(u))
|
||||
if err != nil {
|
||||
log.Error(4, "HTMLString: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
msg := NewMessage([]string{u.Email}, c.Tr("mail.register_notify"), body)
|
||||
msg.Info = fmt.Sprintf("UID: %d, registration notify", u.Id)
|
||||
|
||||
SendAsync(msg)
|
||||
}
|
||||
|
||||
// SendActivateAccountMail sends confirmation e-mail.
|
||||
func SendActivateEmailMail(c *macaron.Context, u *models.User, email *models.EmailAddress) {
|
||||
data := ComposeTplData(u)
|
||||
|
Reference in New Issue
Block a user