Merge pull request #334 from wsczx/dev

邮件模板中增加LimitTime过期时间字段
This commit is contained in:
bjdgyc 2024-09-02 10:37:07 +08:00 committed by GitHub
commit d796a6850a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View File

@ -220,6 +220,7 @@ type userAccountMailData struct {
Username string
Nickname string
PinCode string
LimitTime string
OtpImg string
OtpImgBase64 string
DisableOtp bool
@ -276,6 +277,13 @@ func userAccountMail(user *dbdata.User) error {
OtpImgBase64: "data:image/png;base64," + otpData,
DisableOtp: user.DisableOtp,
}
if user.LimitTime == nil {
data.LimitTime = "无限制"
} else {
data.LimitTime = user.LimitTime.Local().Format("2006-01-02")
}
w := bytes.NewBufferString("")
t, _ := template.New("auth_complete").Parse(htmlBody)
err = t.Execute(w, data)

View File

@ -184,6 +184,7 @@ const accountMail = `<p>您好:</p>
用户组: <b>{{.Group}}</b> <br/>
用户名: <b>{{.Username}}</b> <br/>
用户PIN码: <b>{{.PinCode}}</b> <br/>
用户过期时间: <b>{{.LimitTime}}</b> <br/>
{{if .DisableOtp}}
<!-- nothing -->
{{else}}