diff options
author | FuXiaoHei <fuxiaohei@hexiaz.com> | 2014-04-06 14:54:39 +0800 |
---|---|---|
committer | FuXiaoHei <fuxiaohei@hexiaz.com> | 2014-04-06 14:54:39 +0800 |
commit | 98f918ed28d5a8b1c131cda587a06714a768f951 (patch) | |
tree | 04b202dfc2f639eba39304c8051bde8270b5349c /modules/mailer/mail.go | |
parent | 3ede496383bc0e5ad2cb9c5f034890bb6d626b3c (diff) | |
parent | b7c3b0cc73ad8721e2eec59d018a91850ba7f750 (diff) |
Merge branch 'dev' of https://github.com/gogits/gogs into dev
Diffstat (limited to 'modules/mailer/mail.go')
-rw-r--r-- | modules/mailer/mail.go | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/modules/mailer/mail.go b/modules/mailer/mail.go index b99fc8fd..eee6b916 100644 --- a/modules/mailer/mail.go +++ b/modules/mailer/mail.go @@ -86,7 +86,27 @@ func SendActiveMail(r *middleware.Render, user *models.User) { } msg := NewMailMessage([]string{user.Email}, subject, body) - msg.Info = fmt.Sprintf("UID: %d, send email verify mail", user.Id) + msg.Info = fmt.Sprintf("UID: %d, send active mail", user.Id) + + SendAsync(&msg) +} + +// Send reset password email. +func SendResetPasswdMail(r *middleware.Render, user *models.User) { + code := CreateUserActiveCode(user, nil) + + subject := "Reset your password" + + data := GetMailTmplData(user) + data["Code"] = code + body, err := r.HTMLString("mail/auth/reset_passwd", data) + if err != nil { + log.Error("mail.SendResetPasswdMail(fail to render): %v", err) + return + } + + msg := NewMailMessage([]string{user.Email}, subject, body) + msg.Info = fmt.Sprintf("UID: %d, send reset password email", user.Id) SendAsync(&msg) } |