diff --git a/internal/email/templates.go b/internal/email/templates.go index 4d36510..5f7bfe6 100644 --- a/internal/email/templates.go +++ b/internal/email/templates.go @@ -1,6 +1,9 @@ package email -import "fmt" +import ( + "fmt" + "html" +) func emailWrapper(content string) string { return fmt.Sprintf(` @@ -24,7 +27,7 @@ func renderVerificationEmail(name, verifyURL string) string {

Or copy and paste this link into your browser:

%s

-

This link expires in 24 hours.

`, name, verifyURL, verifyURL)) +

This link expires in 24 hours.

`, html.EscapeString(name), verifyURL, verifyURL)) } func renderPasswordResetEmail(name, resetURL string) string { @@ -37,7 +40,7 @@ func renderPasswordResetEmail(name, resetURL string) string {

Or copy and paste this link into your browser:

%s

-

This link expires in 1 hour. If you didn't request this, please ignore this email.

`, name, resetURL, resetURL)) +

This link expires in 1 hour. If you didn't request this, please ignore this email.

`, html.EscapeString(name), resetURL, resetURL)) } func renderTicketClosedEmail(name, ticketTitle, ticketURL string) string { @@ -48,7 +51,7 @@ func renderTicketClosedEmail(name, ticketTitle, ticketURL string) string {

View Ticket

-

If you believe the issue is not fully resolved, you can add a comment on the ticket page.

`, name, ticketTitle, ticketURL)) +

If you believe the issue is not fully resolved, you can add a comment on the ticket page.

`, html.EscapeString(name), html.EscapeString(ticketTitle), ticketURL)) } func renderTicketReplyEmail(name, ticketTitle, ticketURL string) string { @@ -58,7 +61,7 @@ func renderTicketReplyEmail(name, ticketTitle, ticketURL string) string {

There is a new reply on your ticket "%s".

View Ticket -

`, name, ticketTitle, ticketURL)) +

`, html.EscapeString(name), html.EscapeString(ticketTitle), ticketURL)) } func renderAccountApprovedEmail(name, loginURL string) string { @@ -68,7 +71,7 @@ func renderAccountApprovedEmail(name, loginURL string) string {

Your account request has been approved. You can now log in and start creating tickets.

Log In -

`, name, loginURL)) +

`, html.EscapeString(name), loginURL)) } func renderWelcomeEmail(name, email, tempPassword, loginURL string) string { @@ -83,5 +86,5 @@ func renderWelcomeEmail(name, email, tempPassword, loginURL string) string {

Log In

-

Please change your password after logging in.

`, name, email, tempPassword, loginURL)) +

Please change your password after logging in.

`, html.EscapeString(name), html.EscapeString(email), html.EscapeString(tempPassword), loginURL)) }