mirror of
https://github.com/grafana/grafana.git
synced 2025-01-07 22:53:56 -06:00
Final work password reset email, Closes #1456
This commit is contained in:
parent
95fd34ed14
commit
bb2d810709
@ -188,6 +188,7 @@ from_address = admin@grafana.localhost
|
||||
|
||||
[emails]
|
||||
welcome_email_on_sign_up = false
|
||||
templates_pattern = emails/*.html
|
||||
|
||||
#################################### Logging ##########################
|
||||
[log]
|
||||
|
@ -32,7 +32,7 @@ func Init() error {
|
||||
"Subject": subjectTemplateFunc,
|
||||
})
|
||||
|
||||
templatePattern := filepath.Join(setting.StaticRootPath, "emails/*.html")
|
||||
templatePattern := filepath.Join(setting.StaticRootPath, setting.Smtp.TemplatesPattern)
|
||||
_, err := mailTemplates.ParseGlob(templatePattern)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -15,6 +15,8 @@ func TestNotifications(t *testing.T) {
|
||||
bus.ClearBusHandlers()
|
||||
|
||||
setting.StaticRootPath = "../../../public/"
|
||||
setting.Smtp.Enabled = true
|
||||
setting.Smtp.TemplatesPattern = "emails/*.html"
|
||||
setting.Smtp.FromAddress = "from@address.com"
|
||||
|
||||
err := Init()
|
||||
@ -26,7 +28,8 @@ func TestNotifications(t *testing.T) {
|
||||
}
|
||||
|
||||
Convey("When sending reset email password", func() {
|
||||
sendResetPasswordEmail(&m.SendResetPasswordEmailCommand{User: &m.User{Email: "asd@asd.com"}})
|
||||
err := sendResetPasswordEmail(&m.SendResetPasswordEmailCommand{User: &m.User{Email: "asd@asd.com"}})
|
||||
So(err, ShouldBeNil)
|
||||
So(sentMsg.Body, ShouldContainSubstring, "body")
|
||||
So(sentMsg.Subject, ShouldEqual, "Reset your Grafana password")
|
||||
So(sentMsg.Body, ShouldNotContainSubstring, "Subject")
|
||||
|
@ -11,6 +11,7 @@ type SmtpSettings struct {
|
||||
SkipVerify bool
|
||||
|
||||
SendWelcomeEmailOnSignUp bool
|
||||
TemplatesPattern string
|
||||
}
|
||||
|
||||
func readSmtpSettings() {
|
||||
@ -26,4 +27,5 @@ func readSmtpSettings() {
|
||||
|
||||
emails := Cfg.Section("emails")
|
||||
Smtp.SendWelcomeEmailOnSignUp = emails.Key("welcome_email_on_sign_up").MustBool(false)
|
||||
Smtp.TemplatesPattern = emails.Key("templates_pattern").MustString("emails/*.html")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user