diff options
author | slene <vslene@gmail.com> | 2014-03-20 09:17:24 +0800 |
---|---|---|
committer | slene <vslene@gmail.com> | 2014-03-20 09:17:24 +0800 |
commit | 8b0f421eb504075b7500575515282cd7da8b0878 (patch) | |
tree | e10c71d7fff99207540bac25437165e0aa4da7ac /modules/mailer/mail.go | |
parent | 0e7a2d9d3c59a67e9681d8e6e0d813c191777e2c (diff) | |
parent | 6f6862086047ba6902f51de3cb66eb3af04fffbd (diff) |
Merge branch 'master' of github.com:gogits/gogs
Diffstat (limited to 'modules/mailer/mail.go')
-rw-r--r-- | modules/mailer/mail.go | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/modules/mailer/mail.go b/modules/mailer/mail.go index de4f24a4..92acd20e 100644 --- a/modules/mailer/mail.go +++ b/modules/mailer/mail.go @@ -37,9 +37,9 @@ func GetMailTmplData(user *models.User) map[interface{}]interface{} { // create a time limit code for user active func CreateUserActiveCode(user *models.User, startInf interface{}) string { - hours := base.Service.ActiveCodeLives / 60 + minutes := base.Service.ActiveCodeLives data := base.ToStr(user.Id) + user.Email + user.LowerName + user.Passwd + user.Rands - code := base.CreateTimeLimitCode(data, hours, startInf) + code := base.CreateTimeLimitCode(data, minutes, startInf) // add tail hex username code += hex.EncodeToString([]byte(user.LowerName)) @@ -62,19 +62,18 @@ func SendRegisterMail(r *middleware.Render, user *models.User) { msg := NewMailMessage([]string{user.Email}, subject, body) msg.Info = fmt.Sprintf("UID: %d, send register mail", user.Id) - // async send mail - SendAsync(msg) + SendAsync(&msg) } // Send email verify active email. func SendActiveMail(r *middleware.Render, user *models.User) { code := CreateUserActiveCode(user, nil) - subject := "Verify your email address" + subject := "Verify your e-mail address" data := GetMailTmplData(user) data["Code"] = code - body, err := r.HTMLString("mail/auth/active_email.html", data) + body, err := r.HTMLString("mail/auth/active_email", data) if err != nil { log.Error("mail.SendActiveMail(fail to render): %v", err) return @@ -83,6 +82,5 @@ 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) - // async send mail - SendAsync(msg) + SendAsync(&msg) } |