From 7bf4c238c2b96f60f10a5c17cf2bf9e623f51742 Mon Sep 17 00:00:00 2001 From: eson <474420502@qq.com> Date: Wed, 6 Sep 2023 00:06:10 +0800 Subject: [PATCH 1/4] fix --- fs_template/email_register.tpl | 13 +++++-- fs_template/get_reset_password_html.tpl | 13 +++++-- server/auth/internal/logic/websocket_test.go | 39 ++++++++++++++++++-- 3 files changed, 55 insertions(+), 10 deletions(-) diff --git a/fs_template/email_register.tpl b/fs_template/email_register.tpl index c5b8cb2a..56cb1735 100644 --- a/fs_template/email_register.tpl +++ b/fs_template/email_register.tpl @@ -1,5 +1,11 @@ -Subject: Please confirm your {{ .CompanyName }} account +Subject: Please confirm your {{ .CompanyName }} account; +MIME-version: 1.0; +Content-Type: text/html; charset="UTF-8"; +From: "Fusen Support"; + + + Dear {{ .UserName }}, Thank you for registering an account with {{ .CompanyName }}. We are thrilled to have you join our community! @@ -8,7 +14,6 @@ Please take a moment to confirm your email address by clicking the button below Confirm Account: {{ .UserName }} - 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! @@ -17,4 +22,6 @@ Regards, {{ .SenderName }} {{ .SenderTitle }} -{{ .CompanyName }} \ No newline at end of file +{{ .CompanyName }} + + \ No newline at end of file diff --git a/fs_template/get_reset_password_html.tpl b/fs_template/get_reset_password_html.tpl index 4cd78739..8f9423d6 100644 --- a/fs_template/get_reset_password_html.tpl +++ b/fs_template/get_reset_password_html.tpl @@ -1,5 +1,10 @@ Subject: Password Reset Request for Your {{ .CompanyName }} Account +MIME-version: 1.0; +Content-Type: text/html; charset="UTF-8"; +From: "Fusen Support"; + + Dear {{ .UserName }}, We have received your request to reset the password for your {{ .CompanyName }} account. @@ -16,6 +21,8 @@ To proceed with the password reset, please click the button below to open the Re Please note that this password reset confirmation link will expire in 60 minutes. If you have any further questions, feel free to reach out to us. Regards, -{{ .SenderName }}
-{{ .SenderTitle }}
-{{ .CompanyName }} \ No newline at end of file +{{ .SenderName }} +{{ .SenderTitle }} +{{ .CompanyName }} + + \ No newline at end of file diff --git a/server/auth/internal/logic/websocket_test.go b/server/auth/internal/logic/websocket_test.go index 2ebc4044..639674ea 100644 --- a/server/auth/internal/logic/websocket_test.go +++ b/server/auth/internal/logic/websocket_test.go @@ -28,10 +28,41 @@ func TestEmailSend(t *testing.T) { auth := smtp.PlainAuth("", "support@fusenpack.com", "wfbjpdgvaozjvwah", smtpServer) - subject := "Subject: Test email from Go!\n" - mime := "MIME-version: 1.0;\nContent-Type: text/html; charset=\"UTF-8\";\n\n" - body := "

Hello World!

" - msg := []byte(subject + mime + body) + msg := []byte(`Subject: Password Reset Request for Your Account; +MIME-version: 1.0; +Content-Type: text/html; charset="UTF-8"; +From: "Fusen"; + + + + + Password Reset for Your {{.CompanyName}} Account + + + +

Dear {{.UserName}},

+ +

We have received your request to reset the password for your {{.CompanyName}} account.

+ +

To proceed with the password reset, please click the button below to open the Reset Password page:

+ +
+ + Reset Password + +
+ +

Please note that this password reset confirmation link will expire in 60 minutes. If you have any further questions, feel free to reach out to us.

+ +

Regards,

+ +

{{.SenderName}}
+{{.SenderTitle}}
+{{.CompanyName}}

+ + +`) // 发送邮件 err := smtp.SendMail(smtpServer+":587", auth, from, to, msg) From 8e84eb4d00dfa5da8c4012848509542a0e569683 Mon Sep 17 00:00:00 2001 From: eson <474420502@qq.com> Date: Wed, 6 Sep 2023 00:08:51 +0800 Subject: [PATCH 2/4] fix --- server/auth/internal/logic/email_manager.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/auth/internal/logic/email_manager.go b/server/auth/internal/logic/email_manager.go index 15ac3c0c..4d1bd84a 100644 --- a/server/auth/internal/logic/email_manager.go +++ b/server/auth/internal/logic/email_manager.go @@ -222,7 +222,7 @@ func RenderEmailTemplate(templateName, companyName, confirmationLink, senderName } var result bytes.Buffer - result.Write([]byte("MIME-version: 1.0;\nContent-Type: text/html; charset=\"UTF-8\";\n\n")) + // result.Write([]byte("MIME-version: 1.0;\nContent-Type: text/html; charset=\"UTF-8\";\n\n")) err := tpls.ExecuteTemplate(&result, templateName, data) if err != nil { log.Fatal(err) From 60494f053354d8b2676f27a44fea8c8956bbb019 Mon Sep 17 00:00:00 2001 From: eson <474420502@qq.com> Date: Wed, 6 Sep 2023 00:12:14 +0800 Subject: [PATCH 3/4] fix --- fs_template/get_reset_password_html.tpl | 32 ++++++++++++++----------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/fs_template/get_reset_password_html.tpl b/fs_template/get_reset_password_html.tpl index 8f9423d6..d10cf44b 100644 --- a/fs_template/get_reset_password_html.tpl +++ b/fs_template/get_reset_password_html.tpl @@ -3,26 +3,30 @@ MIME-version: 1.0; Content-Type: text/html; charset="UTF-8"; From: "Fusen Support"; + -Dear {{ .UserName }}, -We have received your request to reset the password for your {{ .CompanyName }} account. +

Dear {{.UserName}},

-To proceed with the password reset, please click the button below to open the Reset Password page: +

We have received your request to reset the password for your {{.CompanyName}} account.

+ +

To proceed with the password reset, please click the button below to open the Reset Password page:

- - Reset Password - + + Reset Password +
-Please note that this password reset confirmation link will expire in 60 minutes. If you have any further questions, feel free to reach out to us. +

Please note that this password reset confirmation link will expire in 60 minutes. If you have any further questions, feel free to reach out to us.

-Regards, -{{ .SenderName }} -{{ .SenderTitle }} -{{ .CompanyName }} - - \ No newline at end of file +

Regards,

+ +

{{.SenderName}}
+{{.SenderTitle}}
+{{.CompanyName}}

+ + + \ No newline at end of file From 68f80e4ec939f3757387a02594fac1bea742b44f Mon Sep 17 00:00:00 2001 From: eson <474420502@qq.com> Date: Wed, 6 Sep 2023 00:15:24 +0800 Subject: [PATCH 4/4] fix --- fs_template/email_register.tpl | 18 ++++++++++-------- fs_template/get_reset_password_html.tpl | 6 +++--- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/fs_template/email_register.tpl b/fs_template/email_register.tpl index 56cb1735..a58b1dbc 100644 --- a/fs_template/email_register.tpl +++ b/fs_template/email_register.tpl @@ -6,22 +6,24 @@ From: "Fusen Support"; -Dear {{ .UserName }}, -Thank you for registering an account with {{ .CompanyName }}. We are thrilled to have you join our community! +

Dear {{.UserName}},

-Please take a moment to confirm your email address by clicking the button below so we can activate your account: +

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:

Confirm Account: {{ .UserName }} -Confirming your email ensures your account is properly secured. This also lets you access member-only tools and content. +

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! +

If you did not register for {{ .CompanyName }}, please disregard this email. Let us know if you have any other questions!

Regards, -{{ .SenderName }} -{{ .SenderTitle }} -{{ .CompanyName }} +

{{.SenderName}}
+{{.SenderTitle}}
+{{.CompanyName}}

+ \ No newline at end of file diff --git a/fs_template/get_reset_password_html.tpl b/fs_template/get_reset_password_html.tpl index d10cf44b..4b550313 100644 --- a/fs_template/get_reset_password_html.tpl +++ b/fs_template/get_reset_password_html.tpl @@ -24,9 +24,9 @@ From: "Fusen Support";

Regards,

-

{{.SenderName}}
-{{.SenderTitle}}
-{{.CompanyName}}

+

{{.SenderName}}
+{{.SenderTitle}}
+{{.CompanyName}}

\ No newline at end of file