邮件模板中增加LimitTime过期时间字段

This commit is contained in:
wsczx 2024-08-30 19:33:27 +08:00
parent cbdf730481
commit 7160c3cab7
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}}