mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Add reset password, fix #58
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user