mirror of
https://github.com/grafana/grafana.git
synced 2024-12-26 00:41:20 -06:00
feat(signup): added back the welcome on signup completed email
This commit is contained in:
parent
d19e101e6b
commit
99bb9d4fcf
2
.gitignore
vendored
2
.gitignore
vendored
@ -28,4 +28,4 @@ public/css/*.min.css
|
||||
conf/custom.ini
|
||||
fig.yml
|
||||
profile.cov
|
||||
|
||||
grafana
|
||||
|
@ -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,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user