feat(signup): added back the welcome on signup completed email

This commit is contained in:
Torkel Ödegaard 2015-08-31 11:42:12 +02:00
parent d19e101e6b
commit 99bb9d4fcf
2 changed files with 17 additions and 1 deletions

2
.gitignore vendored
View File

@ -28,4 +28,4 @@ public/css/*.min.css
conf/custom.ini
fig.yml
profile.cov
grafana

View File

@ -19,6 +19,7 @@ import (
var mailTemplates *template.Template
var tmplResetPassword = "reset_password.html"
var tmplSignUpStarted = "signup_started.html"
var tmplWelcomeOnSignUp = "welcome_on_signup.html"
func Init() error {
initMailQueue()
@ -28,6 +29,7 @@ func Init() error {
bus.AddHandler("email", sendEmailCommandHandler)
bus.AddEventListener(signUpStartedHandler)
bus.AddEventListener(signUpCompletedHandler)
mailTemplates = template.New("name")
mailTemplates.Funcs(template.FuncMap{
@ -143,3 +145,17 @@ func signUpStartedHandler(evt *events.SignUpStarted) error {
},
})
}
func signUpCompletedHandler(evt *events.SignUpCompleted) error {
if evt.Email == "" || !setting.Smtp.SendWelcomeEmailOnSignUp {
return nil
}
return sendEmailCommandHandler(&m.SendEmailCommand{
To: []string{evt.Email},
Template: tmplSignUpStarted,
Data: map[string]interface{}{
"Name": evt.Name,
},
})
}