diff --git a/api/smtp_templates.go b/api/smtp_templates.go index 9db5c0b..ddf0d0a 100644 --- a/api/smtp_templates.go +++ b/api/smtp_templates.go @@ -2,8 +2,8 @@ package main import ( "fmt" - "html/template" "os" + "text/template" ) var headerTemplate *template.Template @@ -20,9 +20,9 @@ var templates map[string]*template.Template func smtpTemplatesLoad() error { var err error headerTemplate, err = template.New("header").Parse(`MIME-Version: 1.0 -Content-Type: text/html; charset=UTF-8 -From: {{.FromAddress}} +From: Commento <{{.FromAddress}}> To: {{.ToName}} <{{.ToAddress}}> +Content-Type: text/plain; charset=UTF-8 Subject: {{.Subject}} `) @@ -39,9 +39,9 @@ Subject: {{.Subject}} for _, name := range names { var err error templates[name] = template.New(name) - templates[name], err = template.ParseFiles(fmt.Sprintf("%s/templates/%s.html", os.Getenv("STATIC"), name)) + templates[name], err = template.ParseFiles(fmt.Sprintf("%s/templates/%s.txt", os.Getenv("STATIC"), name)) if err != nil { - logger.Errorf("cannot parse %s/templates/%s.html: %v", os.Getenv("STATIC"), name, err) + logger.Errorf("cannot parse %s/templates/%s.txt: %v", os.Getenv("STATIC"), name, err) return errorMalformedTemplate } } diff --git a/templates/Makefile b/templates/Makefile index 21ae714..d6dc41c 100644 --- a/templates/Makefile +++ b/templates/Makefile @@ -5,7 +5,7 @@ DEVEL_BUILD_DIR = $(BUILD_DIR)/devel PROD_BUILD_DIR = $(BUILD_DIR)/prod TEMPLATES_SRC_DIR = . -TEMPLATES_SRC_FILES = $(wildcard $(TEMPLATES_SRC_DIR)/*.html) +TEMPLATES_SRC_FILES = $(wildcard $(TEMPLATES_SRC_DIR)/*.txt) TEMPLATES_DEVEL_BUILD_DIR = $(DEVEL_BUILD_DIR)/templates TEMPLATES_DEVEL_BUILD_FILES = $(patsubst $(TEMPLATES_SRC_DIR)/%, $(TEMPLATES_DEVEL_BUILD_DIR)/%, $(TEMPLATES_SRC_FILES)) TEMPLATES_PROD_BUILD_DIR = $(PROD_BUILD_DIR)/templates @@ -20,12 +20,12 @@ clean: devel-templates: $(TEMPLATES_DEVEL_BUILD_FILES) -$(TEMPLATES_DEVEL_BUILD_FILES): $(TEMPLATES_DEVEL_BUILD_DIR)/%.html: $(TEMPLATES_SRC_DIR)/%.html +$(TEMPLATES_DEVEL_BUILD_FILES): $(TEMPLATES_DEVEL_BUILD_DIR)/%.txt: $(TEMPLATES_SRC_DIR)/%.txt cp $^ $@; prod-templates: $(TEMPLATES_PROD_BUILD_FILES) -$(TEMPLATES_PROD_BUILD_FILES): $(TEMPLATES_PROD_BUILD_DIR)/%.html: $(TEMPLATES_SRC_DIR)/%.html +$(TEMPLATES_PROD_BUILD_FILES): $(TEMPLATES_PROD_BUILD_DIR)/%.txt: $(TEMPLATES_SRC_DIR)/%.txt cp $^ $@; $(shell mkdir -p $(TEMPLATES_DEVEL_BUILD_DIR) $(TEMPLATES_PROD_BUILD_DIR)) diff --git a/templates/confirm-hex.html b/templates/confirm-hex.html deleted file mode 100644 index b30f0a6..0000000 --- a/templates/confirm-hex.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - Commento: Verify your email address - - - - - - - - - -
- - - - - - -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Verify your email address - -
- - In order to start using Commento, you need to first confirm your email address. Click the link below to do that. - -
- - Verify Email Address - -
-
- - - - - - - - - -
- - If you did not sign up for this account you can safely ignore this email and the account will be automatically deleted. - -
-
-
- - diff --git a/templates/confirm-hex.txt b/templates/confirm-hex.txt new file mode 100644 index 0000000..d4a6e93 --- /dev/null +++ b/templates/confirm-hex.txt @@ -0,0 +1,7 @@ +Hi, + +You recently registered a new Commento account with this email address. If you wish to complete registration, use the link below: + +{{.Origin}}/api/owner/confirm-hex?confirmHex={{.ConfirmHex}} + +If you did not do initiate this, you can ignore this email. diff --git a/templates/reset-hex.html b/templates/reset-hex.html deleted file mode 100644 index 7187bae..0000000 --- a/templates/reset-hex.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - Commento: Reset your password - - - - - - - - - -
- - - - - - -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- - Reset your Password - -
- - Someone (probably you) recently initiated the procedure to reset your Commento account password. To complete this, click the link below and set your new password. - -
- - Reset Password - -
-
- - - - - - - - - -
- - If you did not initiate this request, you can safely ignore this email. - -
-
-
- - diff --git a/templates/reset-hex.txt b/templates/reset-hex.txt new file mode 100644 index 0000000..ec7c4b0 --- /dev/null +++ b/templates/reset-hex.txt @@ -0,0 +1,7 @@ +Hi, + +Someone (probably you) recently initiated the procedure to reset your Commento account password. To do this, use the link below: + +{{.Origin}}/reset-password?hex={{.ResetHex}} + +If you did not initiate this request, you can safely ignore this email.