Commit 99bb9d4f by Torkel Ödegaard

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

parent d19e101e
...@@ -28,4 +28,4 @@ public/css/*.min.css ...@@ -28,4 +28,4 @@ public/css/*.min.css
conf/custom.ini conf/custom.ini
fig.yml fig.yml
profile.cov profile.cov
grafana
...@@ -19,6 +19,7 @@ import ( ...@@ -19,6 +19,7 @@ import (
var mailTemplates *template.Template var mailTemplates *template.Template
var tmplResetPassword = "reset_password.html" var tmplResetPassword = "reset_password.html"
var tmplSignUpStarted = "signup_started.html" var tmplSignUpStarted = "signup_started.html"
var tmplWelcomeOnSignUp = "welcome_on_signup.html"
func Init() error { func Init() error {
initMailQueue() initMailQueue()
...@@ -28,6 +29,7 @@ func Init() error { ...@@ -28,6 +29,7 @@ func Init() error {
bus.AddHandler("email", sendEmailCommandHandler) bus.AddHandler("email", sendEmailCommandHandler)
bus.AddEventListener(signUpStartedHandler) bus.AddEventListener(signUpStartedHandler)
bus.AddEventListener(signUpCompletedHandler)
mailTemplates = template.New("name") mailTemplates = template.New("name")
mailTemplates.Funcs(template.FuncMap{ mailTemplates.Funcs(template.FuncMap{
...@@ -143,3 +145,17 @@ func signUpStartedHandler(evt *events.SignUpStarted) error { ...@@ -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,
},
})
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment