Skip to content

Commit

Permalink
Merge pull request #29 from MuShare/fix/mail-app-name
Browse files Browse the repository at this point in the history
Fix mail app name
  • Loading branch information
lm2343635 committed Jun 13, 2021
2 parents 6f0dc82 + 9b50b89 commit 9650ea1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
6 changes: 4 additions & 2 deletions utils/mail/mail.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@ func (m *Mail) SendRegisterVerify(userID uint, address string, baseURL string, l
}
var buffer bytes.Buffer
type Data struct {
AppName string
BaseURL string
Token string
}
t.Execute(&buffer, Data{Token: token.B64String(), BaseURL: baseURL})
t.Execute(&buffer, Data{AppName: appName, Token: token.B64String(), BaseURL: baseURL})
localizer := i18n.NewLocalizer(m.bundle, language)
subject, err := localizer.Localize(&i18n.LocalizeConfig{
MessageID: "VerifyMailSubject",
Expand Down Expand Up @@ -130,10 +131,11 @@ func (m *Mail) SendResetPassword(appID, address string, baseURL string, userLang

var buffer bytes.Buffer
type Data struct {
AppName string
BaseURL string
Token string
}
t.Execute(&buffer, Data{Token: token.B64String(), BaseURL: baseURL})
t.Execute(&buffer, Data{AppName: appName, Token: token.B64String(), BaseURL: baseURL})
localizer := i18n.NewLocalizer(m.bundle, userLanguage)
subject, err := localizer.Localize(&i18n.LocalizeConfig{
MessageID: "ResetPasswordMailSubject",
Expand Down
7 changes: 4 additions & 3 deletions views/en/password_reset_mail.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</head>
<body style="background: #fafafa; font-family: Lato, 'Helvetica Neue', Arial, Helvetica, sans-serif">
<div class="ui container" style="width: auto !important; max-width: 600px; margin: 0 auto">
<h2 id="app-name" style="margin: 20px 0; text-align: center">Pluto</h2>
<h2 id="app-name" style="margin: 20px 0; text-align: center">{{.AppName}}</h2>
<div id="message-content" class="ui card"
style="width: 100%; background: #FFF; border-radius: 5px; box-shadow: 0 1px 3px 0 #D4D4D5, 0 0 0 1px #D4D4D5">
<div class="content" style="padding: 1em">
Expand All @@ -18,7 +18,7 @@ <h4 style="margin: 0">Reset Password</h4>
<div class="content" style="padding: 1em">
<h5 style="margin: 1em 0; font-size: 15px; font-weight: normal">Dear user,</h5>
<h5 style="margin: 1em 0; font-size: 15px; font-weight: normal">We send this mail to you, because you have
sent a request for resetting your password of Pluto login service.</h5>
sent a request for resetting your password of {{.AppName}} login service.</h5>
<h5 style="margin: 1em 0; font-size: 15px; font-weight: normal">You can reset your password by clicking this
button within 10 minutes.</h5>
<a href="https://{{.BaseURL}}/web/password/reset/{{.Token}}" class="ui submit button primary"
Expand All @@ -31,9 +31,10 @@ <h5 style="margin: 1em 0; font-size: 15px; font-weight: normal">If you cannot op
<h5 style="margin: 1em 0; font-size: 15px; font-weight: normal">If you did not send such request, just
ignore this mail.</h5>
<h5 style="margin: 1em 0; font-size: 15px; font-weight: normal">Sincerely yours,</h5>
<h5 style="margin: 1em 0; font-size: 15px; font-weight: normal">Pluto</h5>
<h5 style="margin: 1em 0; font-size: 15px; font-weight: normal">{{.AppName}}</h5>
</div>
</div>
<br>
<div class="item" style="color: rgba(0, 0, 0, .4);
text-align: center;
display: block;
Expand Down
5 changes: 3 additions & 2 deletions views/en/register_verify_mail.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</head>
<body style="background: #fafafa; font-family: Lato, 'Helvetica Neue', Arial, Helvetica, sans-serif">
<div class="ui container" style="width: auto !important; max-width: 600px; margin: 0 auto">
<h2 id="app-name" style="margin: 20px 0; text-align: center">Pluto</h2>
<h2 id="app-name" style="margin: 20px 0; text-align: center">{{.AppName}}</h2>
<div id="message-content" class="ui card"
style="width: 100%; background: #FFF; border-radius: 5px; box-shadow: 0 1px 3px 0 #D4D4D5, 0 0 0 1px #D4D4D5">
<div class="content" style="padding: 1em">
Expand All @@ -27,9 +27,10 @@ <h5 style="margin: 1em 0; font-size: 15px; font-weight: normal">If you cannot op
<h5 style="margin: 1em 0; font-size: 15px; font-weight: normal">If you did not send such request, just
ignore this mail.</h5>
<h5 style="margin: 1em 0; font-size: 15px; font-weight: normal">Sincerely yours,</h5>
<h5 style="margin: 1em 0; font-size: 15px; font-weight: normal">Pluto Developer</h5>
<h5 style="margin: 1em 0; font-size: 15px; font-weight: normal">{{.AppName}}</h5>
</div>
</div>
<br>
<div class="item" style="color: rgba(0, 0, 0, .4);
text-align: center;
display: block;
Expand Down

0 comments on commit 9650ea1

Please sign in to comment.