From 0a6bdceccb613d2a9acc88e6c2ada51973b1c78c Mon Sep 17 00:00:00 2001 From: enahum Date: Wed, 13 Jul 2016 13:03:46 -0400 Subject: PLT-3384 Improve the "Verify Email" email (#3564) --- api/user.go | 14 +++++++++----- i18n/en.json | 10 +++++----- templates/welcome_body.html | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/api/user.go b/api/user.go index c64315440..846978971 100644 --- a/api/user.go +++ b/api/user.go @@ -349,17 +349,19 @@ func CreateOAuthUser(c *Context, w http.ResponseWriter, r *http.Request, service } func sendWelcomeEmail(c *Context, userId string, email string, siteURL string, verified bool) { + rawUrl, _ := url.Parse(siteURL) + subjectPage := utils.NewHTMLTemplate("welcome_subject", c.Locale) - subjectPage.Props["Subject"] = c.T("api.templates.welcome_subject", map[string]interface{}{"TeamDisplayName": siteURL}) + subjectPage.Props["Subject"] = c.T("api.templates.welcome_subject", map[string]interface{}{"ServerURL": rawUrl.Host}) bodyPage := utils.NewHTMLTemplate("welcome_body", c.Locale) bodyPage.Props["SiteURL"] = siteURL - bodyPage.Props["Title"] = c.T("api.templates.welcome_body.title", map[string]interface{}{"TeamDisplayName": siteURL}) + bodyPage.Props["Title"] = c.T("api.templates.welcome_body.title", map[string]interface{}{"ServerURL": rawUrl.Host}) bodyPage.Props["Info"] = c.T("api.templates.welcome_body.info") bodyPage.Props["Button"] = c.T("api.templates.welcome_body.button") bodyPage.Props["Info2"] = c.T("api.templates.welcome_body.info2") bodyPage.Props["Info3"] = c.T("api.templates.welcome_body.info3") - bodyPage.Props["TeamURL"] = siteURL + bodyPage.Props["SiteURL"] = siteURL if !verified { link := fmt.Sprintf("%s/do_verify_email?uid=%s&hid=%s&email=%s", siteURL, userId, model.HashPassword(userId), url.QueryEscape(email)) @@ -411,13 +413,15 @@ func addDirectChannels(teamId string, user *model.User) { func SendVerifyEmail(c *Context, userId, userEmail, siteURL string) { link := fmt.Sprintf("%s/do_verify_email?uid=%s&hid=%s&email=%s", siteURL, userId, model.HashPassword(userId), url.QueryEscape(userEmail)) + url, _ := url.Parse(siteURL) + subjectPage := utils.NewHTMLTemplate("verify_subject", c.Locale) subjectPage.Props["Subject"] = c.T("api.templates.verify_subject", - map[string]interface{}{"TeamDisplayName": utils.ClientCfg["SiteName"], "SiteName": utils.ClientCfg["SiteName"]}) + map[string]interface{}{"SiteName": utils.ClientCfg["SiteName"]}) bodyPage := utils.NewHTMLTemplate("verify_body", c.Locale) bodyPage.Props["SiteURL"] = siteURL - bodyPage.Props["Title"] = c.T("api.templates.verify_body.title", map[string]interface{}{"TeamDisplayName": utils.ClientCfg["SiteName"]}) + bodyPage.Props["Title"] = c.T("api.templates.verify_body.title", map[string]interface{}{"ServerURL": url.Host}) bodyPage.Props["Info"] = c.T("api.templates.verify_body.info") bodyPage.Props["VerifyUrl"] = link bodyPage.Props["Button"] = c.T("api.templates.verify_body.button") diff --git a/i18n/en.json b/i18n/en.json index 4198b82af..cce65ebaf 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -1589,11 +1589,11 @@ }, { "id": "api.templates.verify_body.title", - "translation": "You've joined the {{ .TeamDisplayName }} team" + "translation": "You've joined {{ .ServerURL }}" }, { "id": "api.templates.verify_subject", - "translation": "[{{ .TeamDisplayName }} {{ .SiteName }}] Email Verification" + "translation": "[{{ .SiteName }}] Email Verification" }, { "id": "api.templates.welcome_body.button", @@ -1605,7 +1605,7 @@ }, { "id": "api.templates.welcome_body.info2", - "translation": "You can sign-in to your new team from the web address:" + "translation": "You can sign in from:" }, { "id": "api.templates.welcome_body.info3", @@ -1613,11 +1613,11 @@ }, { "id": "api.templates.welcome_body.title", - "translation": "You've joined the {{ .TeamDisplayName }} team" + "translation": "You've joined {{ .ServerURL }}" }, { "id": "api.templates.welcome_subject", - "translation": "You joined {{ .TeamDisplayName }}" + "translation": "You joined {{ .ServerURL }}" }, { "id": "api.user.activate_mfa.email_and_ldap_only.app_error", diff --git a/templates/welcome_body.html b/templates/welcome_body.html index b5ca9beb3..8dee99cf5 100644 --- a/templates/welcome_body.html +++ b/templates/welcome_body.html @@ -29,7 +29,7 @@

{{.Props.Info2}}

- {{.Props.TeamURL}} + {{.Props.SiteURL}}

{{.Props.Info3}}

-- cgit v1.2.3-1-g7c22