fix
This commit is contained in:
parent
9c013ac494
commit
88ae58c9d8
|
@ -4,28 +4,6 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
const emailTemplate = `Subject: Please confirm your {{CompanyName}} account
|
|
||||||
|
|
||||||
Dear ,
|
|
||||||
|
|
||||||
Thank you for registering an account with {{CompanyName}}. We are thrilled to have you join our community!
|
|
||||||
|
|
||||||
Please take a moment to confirm your email address by clicking the button below so we can activate your account:
|
|
||||||
|
|
||||||
<a href="{{ConfirmationLink}}" target="_blank" style="background-color: #008CBA; color: #FFFFFF; text-decoration: none; padding: 10px 15px; border-radius: 3px; display:inline-block; font-weight: bold;">Confirm My Account</a>
|
|
||||||
|
|
||||||
Confirming your email ensures your account is properly secured. This also lets you access member-only tools and content.
|
|
||||||
|
|
||||||
If you did not register for {{CompanyName}}, please disregard this email. Let us know if you have any other questions!
|
|
||||||
|
|
||||||
Regards,
|
|
||||||
|
|
||||||
{{SenderName}}
|
|
||||||
{{SenderTitle}}
|
|
||||||
{{CompanyName}}
|
|
||||||
`
|
|
||||||
|
|
||||||
func TestMain(t *testing.T) {
|
func TestMain(t *testing.T) {
|
||||||
|
|
||||||
main()
|
main()
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,16 @@ var EmailTaskResendTime = time.Second * 30
|
||||||
var TimeLimit *check.TimeLimit[string]
|
var TimeLimit *check.TimeLimit[string]
|
||||||
var EmailManager *EmailSender
|
var EmailManager *EmailSender
|
||||||
|
|
||||||
|
var emailTpl *template.Template
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
||||||
|
tmpl, err := template.New("email").ParseFiles("../../html_template/email_register.tpl")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
emailTpl = tmpl
|
||||||
|
|
||||||
TimeLimit = check.NewTimelimit[string](EmailTaskResendTime)
|
TimeLimit = check.NewTimelimit[string](EmailTaskResendTime)
|
||||||
|
|
||||||
// Initialize the email manager
|
// Initialize the email manager
|
||||||
|
@ -149,11 +157,6 @@ func (m *EmailSender) ClearExpiredTasks() {
|
||||||
|
|
||||||
func RenderEmailTemplate(companyName, confirmationLink, senderName, senderTitle string) []byte {
|
func RenderEmailTemplate(companyName, confirmationLink, senderName, senderTitle string) []byte {
|
||||||
|
|
||||||
tmpl, err := template.New("email").ParseFiles("../../html_template/email_register.tpl")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
data := map[string]string{
|
data := map[string]string{
|
||||||
"CompanyName": companyName,
|
"CompanyName": companyName,
|
||||||
"ConfirmationLink": confirmationLink,
|
"ConfirmationLink": confirmationLink,
|
||||||
|
@ -162,7 +165,7 @@ func RenderEmailTemplate(companyName, confirmationLink, senderName, senderTitle
|
||||||
}
|
}
|
||||||
|
|
||||||
var result bytes.Buffer
|
var result bytes.Buffer
|
||||||
err = tmpl.Execute(&result, data)
|
err := emailTpl.Execute(&result, data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user