diff --git a/server/mail/invite.go b/server/mail/invite.go index 599ba6aae..2a9d8b960 100644 --- a/server/mail/invite.go +++ b/server/mail/invite.go @@ -3,6 +3,7 @@ package mail import ( "bytes" "html/template" + "time" "github.com/fleetdm/fleet/v4/server" "github.com/fleetdm/fleet/v4/server/fleet" @@ -11,13 +12,15 @@ import ( // InviteMailer is used to build an email template for the invite email. type InviteMailer struct { *fleet.Invite - BaseURL template.URL - AssetURL template.URL - InvitedBy string - OrgName string + BaseURL template.URL + AssetURL template.URL + InvitedBy string + OrgName string + CurrentYear int } func (i *InviteMailer) Message() ([]byte, error) { + i.CurrentYear = time.Now().Year() t, err := server.GetTemplate("server/mail/templates/invite_token.html", "email_template") if err != nil { return nil, err diff --git a/server/mail/mail.go b/server/mail/mail.go index e4a379e19..8e5ea5c7e 100644 --- a/server/mail/mail.go +++ b/server/mail/mail.go @@ -275,11 +275,13 @@ func dialTimeout(addr string, tlsConfig *tls.Config) (client *smtp.Client, err e // SMTPTestMailer is used to build an email message that will be used as // a test message when testing SMTP configuration type SMTPTestMailer struct { - BaseURL template.URL - AssetURL template.URL + BaseURL template.URL + AssetURL template.URL + CurrentYear int } func (m *SMTPTestMailer) Message() ([]byte, error) { + m.CurrentYear = time.Now().Year() t, err := server.GetTemplate("server/mail/templates/smtp_setup.html", "email_template") if err != nil { return nil, err diff --git a/server/mail/templates/change_email_confirmation.html b/server/mail/templates/change_email_confirmation.html index 37aa99226..7c0e5c936 100644 --- a/server/mail/templates/change_email_confirmation.html +++ b/server/mail/templates/change_email_confirmation.html @@ -162,7 +162,7 @@

- © 2022 Fleet Device Management Inc.
+ © {{.CurrentYear}} Fleet Device Management Inc.
All trademarks, service marks, and company names are the property of their respective owners.

diff --git a/server/mail/templates/invite_token.html b/server/mail/templates/invite_token.html index 724de357a..2051d6f53 100644 --- a/server/mail/templates/invite_token.html +++ b/server/mail/templates/invite_token.html @@ -192,7 +192,7 @@

- © 2022 Fleet Device Management Inc.
+ © {{.CurrentYear}} Fleet Device Management Inc.
All trademarks, service marks, and company names are the property of their respective owners.

diff --git a/server/mail/templates/password_reset.html b/server/mail/templates/password_reset.html index 735a0c3a2..f8f701df9 100644 --- a/server/mail/templates/password_reset.html +++ b/server/mail/templates/password_reset.html @@ -167,7 +167,7 @@

- © 2022 Fleet Device Management Inc.
+ © {{.CurrentYear}} Fleet Device Management Inc.
All trademarks, service marks, and company names are the property of their respective owners.

diff --git a/server/mail/templates/smtp_setup.html b/server/mail/templates/smtp_setup.html index bea81ded6..ca1abee29 100644 --- a/server/mail/templates/smtp_setup.html +++ b/server/mail/templates/smtp_setup.html @@ -141,7 +141,7 @@

- © 2022 Fleet Device Management Inc.
+ © {{.CurrentYear}} Fleet Device Management Inc.
All trademarks, service marks, and company names are the property of their respective owners.

diff --git a/server/mail/users.go b/server/mail/users.go index b90aa5b48..1738dadc8 100644 --- a/server/mail/users.go +++ b/server/mail/users.go @@ -3,17 +3,20 @@ package mail import ( "bytes" "html/template" + "time" "github.com/fleetdm/fleet/v4/server" ) type ChangeEmailMailer struct { - BaseURL template.URL - AssetURL template.URL - Token string + BaseURL template.URL + AssetURL template.URL + Token string + CurrentYear int } func (cem *ChangeEmailMailer) Message() ([]byte, error) { + cem.CurrentYear = time.Now().Year() t, err := server.GetTemplate("server/mail/templates/change_email_confirmation.html", "email_template") if err != nil { return nil, err @@ -33,9 +36,12 @@ type PasswordResetMailer struct { AssetURL template.URL // Token password reset token Token string + // Current year for copyright year + CurrentYear int } func (r PasswordResetMailer) Message() ([]byte, error) { + r.CurrentYear = time.Now().Year() t, err := server.GetTemplate("server/mail/templates/password_reset.html", "email_template") if err != nil { return nil, err