Skip to content

Commit 9650ea1

Browse files
authored
Merge pull request #29 from MuShare/fix/mail-app-name
Fix mail app name
2 parents 6f0dc82 + 9b50b89 commit 9650ea1

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

utils/mail/mail.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,11 @@ func (m *Mail) SendRegisterVerify(userID uint, address string, baseURL string, l
8989
}
9090
var buffer bytes.Buffer
9191
type Data struct {
92+
AppName string
9293
BaseURL string
9394
Token string
9495
}
95-
t.Execute(&buffer, Data{Token: token.B64String(), BaseURL: baseURL})
96+
t.Execute(&buffer, Data{AppName: appName, Token: token.B64String(), BaseURL: baseURL})
9697
localizer := i18n.NewLocalizer(m.bundle, language)
9798
subject, err := localizer.Localize(&i18n.LocalizeConfig{
9899
MessageID: "VerifyMailSubject",
@@ -130,10 +131,11 @@ func (m *Mail) SendResetPassword(appID, address string, baseURL string, userLang
130131

131132
var buffer bytes.Buffer
132133
type Data struct {
134+
AppName string
133135
BaseURL string
134136
Token string
135137
}
136-
t.Execute(&buffer, Data{Token: token.B64String(), BaseURL: baseURL})
138+
t.Execute(&buffer, Data{AppName: appName, Token: token.B64String(), BaseURL: baseURL})
137139
localizer := i18n.NewLocalizer(m.bundle, userLanguage)
138140
subject, err := localizer.Localize(&i18n.LocalizeConfig{
139141
MessageID: "ResetPasswordMailSubject",

views/en/password_reset_mail.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</head>
99
<body style="background: #fafafa; font-family: Lato, 'Helvetica Neue', Arial, Helvetica, sans-serif">
1010
<div class="ui container" style="width: auto !important; max-width: 600px; margin: 0 auto">
11-
<h2 id="app-name" style="margin: 20px 0; text-align: center">Pluto</h2>
11+
<h2 id="app-name" style="margin: 20px 0; text-align: center">{{.AppName}}</h2>
1212
<div id="message-content" class="ui card"
1313
style="width: 100%; background: #FFF; border-radius: 5px; box-shadow: 0 1px 3px 0 #D4D4D5, 0 0 0 1px #D4D4D5">
1414
<div class="content" style="padding: 1em">
@@ -18,7 +18,7 @@ <h4 style="margin: 0">Reset Password</h4>
1818
<div class="content" style="padding: 1em">
1919
<h5 style="margin: 1em 0; font-size: 15px; font-weight: normal">Dear user,</h5>
2020
<h5 style="margin: 1em 0; font-size: 15px; font-weight: normal">We send this mail to you, because you have
21-
sent a request for resetting your password of Pluto login service.</h5>
21+
sent a request for resetting your password of {{.AppName}} login service.</h5>
2222
<h5 style="margin: 1em 0; font-size: 15px; font-weight: normal">You can reset your password by clicking this
2323
button within 10 minutes.</h5>
2424
<a href="https://{{.BaseURL}}/web/password/reset/{{.Token}}" class="ui submit button primary"
@@ -31,9 +31,10 @@ <h5 style="margin: 1em 0; font-size: 15px; font-weight: normal">If you cannot op
3131
<h5 style="margin: 1em 0; font-size: 15px; font-weight: normal">If you did not send such request, just
3232
ignore this mail.</h5>
3333
<h5 style="margin: 1em 0; font-size: 15px; font-weight: normal">Sincerely yours,</h5>
34-
<h5 style="margin: 1em 0; font-size: 15px; font-weight: normal">Pluto</h5>
34+
<h5 style="margin: 1em 0; font-size: 15px; font-weight: normal">{{.AppName}}</h5>
3535
</div>
3636
</div>
37+
<br>
3738
<div class="item" style="color: rgba(0, 0, 0, .4);
3839
text-align: center;
3940
display: block;

views/en/register_verify_mail.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</head>
88
<body style="background: #fafafa; font-family: Lato, 'Helvetica Neue', Arial, Helvetica, sans-serif">
99
<div class="ui container" style="width: auto !important; max-width: 600px; margin: 0 auto">
10-
<h2 id="app-name" style="margin: 20px 0; text-align: center">Pluto</h2>
10+
<h2 id="app-name" style="margin: 20px 0; text-align: center">{{.AppName}}</h2>
1111
<div id="message-content" class="ui card"
1212
style="width: 100%; background: #FFF; border-radius: 5px; box-shadow: 0 1px 3px 0 #D4D4D5, 0 0 0 1px #D4D4D5">
1313
<div class="content" style="padding: 1em">
@@ -27,9 +27,10 @@ <h5 style="margin: 1em 0; font-size: 15px; font-weight: normal">If you cannot op
2727
<h5 style="margin: 1em 0; font-size: 15px; font-weight: normal">If you did not send such request, just
2828
ignore this mail.</h5>
2929
<h5 style="margin: 1em 0; font-size: 15px; font-weight: normal">Sincerely yours,</h5>
30-
<h5 style="margin: 1em 0; font-size: 15px; font-weight: normal">Pluto Developer</h5>
30+
<h5 style="margin: 1em 0; font-size: 15px; font-weight: normal">{{.AppName}}</h5>
3131
</div>
3232
</div>
33+
<br>
3334
<div class="item" style="color: rgba(0, 0, 0, .4);
3435
text-align: center;
3536
display: block;

0 commit comments

Comments
 (0)