Merge pull request #1968 from ZBoxApp/PLT-7-templates
PLT-7: Refactoring api to use translations (chunk 4)
Этот коммит содержится в:
12
api/api.go
12
api/api.go
@@ -19,17 +19,25 @@ var ServerTemplates *template.Template
|
||||
|
||||
type ServerTemplatePage Page
|
||||
|
||||
func NewServerTemplatePage(templateName string) *ServerTemplatePage {
|
||||
func NewServerTemplatePage(templateName, locale string) *ServerTemplatePage {
|
||||
return &ServerTemplatePage{
|
||||
TemplateName: templateName,
|
||||
Props: make(map[string]string),
|
||||
Extra: make(map[string]string),
|
||||
Html: make(map[string]template.HTML),
|
||||
ClientCfg: utils.ClientCfg,
|
||||
Locale: model.DEFAULT_LOCALE,
|
||||
Locale: locale,
|
||||
}
|
||||
}
|
||||
|
||||
func (me *ServerTemplatePage) Render() string {
|
||||
var text bytes.Buffer
|
||||
|
||||
T := utils.GetUserTranslations(me.Locale)
|
||||
me.Props["Footer"] = T("api.templates.email_footer")
|
||||
me.Html["EmailInfo"] = template.HTML(T("api.templates.email_info",
|
||||
map[string]interface{}{"FeedbackEmail": me.ClientCfg["FeedbackEmail"], "SiteName": me.ClientCfg["SiteName"]}))
|
||||
|
||||
if err := ServerTemplates.ExecuteTemplate(&text, me.TemplateName, me); err != nil {
|
||||
l4g.Error(utils.T("api.api.render.error"), me.TemplateName, err)
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"html/template"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@@ -37,6 +38,8 @@ type Context struct {
|
||||
type Page struct {
|
||||
TemplateName string
|
||||
Props map[string]string
|
||||
Extra map[string]string
|
||||
Html map[string]template.HTML
|
||||
ClientCfg map[string]string
|
||||
ClientLicense map[string]string
|
||||
User *model.User
|
||||
@@ -507,6 +510,10 @@ func RenderWebError(err *model.AppError, w http.ResponseWriter, r *http.Request)
|
||||
props["SiteURL"] = GetProtocol(r) + "://" + r.Host
|
||||
}
|
||||
|
||||
T, _ := utils.GetTranslationsAndLocale(w, r)
|
||||
props["Title"] = T("api.templates.error.title", map[string]interface{}{"SiteName": utils.ClientCfg["SiteName"]})
|
||||
props["Link"] = T("api.templates.error.link")
|
||||
|
||||
w.WriteHeader(err.StatusCode)
|
||||
ServerTemplates.ExecuteTemplate(w, "error.html", Page{Props: props, ClientCfg: utils.ClientCfg})
|
||||
}
|
||||
|
||||
35
api/post.go
35
api/post.go
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/mattermost/platform/model"
|
||||
"github.com/mattermost/platform/store"
|
||||
"github.com/mattermost/platform/utils"
|
||||
"html/template"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"path/filepath"
|
||||
@@ -593,28 +594,26 @@ func sendNotificationsAndForget(c *Context, post *model.Post, team *model.Team,
|
||||
channelName = channel.DisplayName
|
||||
}
|
||||
|
||||
subjectPage := NewServerTemplatePage("post_subject")
|
||||
subjectPage.Props["SiteURL"] = c.GetSiteURL()
|
||||
subjectPage.Props["TeamDisplayName"] = team.DisplayName
|
||||
subjectPage.Props["SubjectText"] = subjectText
|
||||
subjectPage.Props["Month"] = tm.Month().String()[:3]
|
||||
subjectPage.Props["Day"] = fmt.Sprintf("%d", tm.Day())
|
||||
subjectPage.Props["Year"] = fmt.Sprintf("%d", tm.Year())
|
||||
month := userLocale(tm.Month().String())
|
||||
day := fmt.Sprintf("%d", tm.Day())
|
||||
year := fmt.Sprintf("%d", tm.Year())
|
||||
zone, _ := tm.Zone()
|
||||
|
||||
bodyPage := NewServerTemplatePage("post_body")
|
||||
subjectPage := NewServerTemplatePage("post_subject", c.Locale)
|
||||
subjectPage.Props["Subject"] = userLocale("api.templates.post_subject",
|
||||
map[string]interface{}{"SubjectText": subjectText, "TeamDisplayName": team.DisplayName,
|
||||
"Month": month[:3], "Day": day, "Year": year})
|
||||
|
||||
bodyPage := NewServerTemplatePage("post_body", c.Locale)
|
||||
bodyPage.Props["SiteURL"] = c.GetSiteURL()
|
||||
bodyPage.Props["Nickname"] = profileMap[id].FirstName
|
||||
bodyPage.Props["TeamDisplayName"] = team.DisplayName
|
||||
bodyPage.Props["ChannelName"] = channelName
|
||||
bodyPage.Props["BodyText"] = bodyText
|
||||
bodyPage.Props["SenderName"] = senderName
|
||||
bodyPage.Props["Hour"] = fmt.Sprintf("%02d", tm.Hour())
|
||||
bodyPage.Props["Minute"] = fmt.Sprintf("%02d", tm.Minute())
|
||||
bodyPage.Props["Month"] = tm.Month().String()[:3]
|
||||
bodyPage.Props["Day"] = fmt.Sprintf("%d", tm.Day())
|
||||
bodyPage.Props["TimeZone"], _ = tm.Zone()
|
||||
bodyPage.Props["PostMessage"] = model.ClearMentionTags(post.Message)
|
||||
bodyPage.Props["TeamLink"] = teamURL + "/channels/" + channel.Name
|
||||
bodyPage.Props["BodyText"] = bodyText
|
||||
bodyPage.Props["Button"] = userLocale("api.templates.post_body.button")
|
||||
bodyPage.Html["Info"] = template.HTML(userLocale("api.templates.post_body.info",
|
||||
map[string]interface{}{"ChannelName": channelName, "SenderName": senderName,
|
||||
"Hour": fmt.Sprintf("%02d", tm.Hour()), "Minute": fmt.Sprintf("%02d", tm.Minute()),
|
||||
"TimeZone": zone, "Month": month, "Day": day}))
|
||||
|
||||
// attempt to fill in a message body if the post doesn't have any text
|
||||
if len(strings.TrimSpace(bodyPage.Props["PostMessage"])) == 0 && len(post.Filenames) > 0 {
|
||||
|
||||
48
api/team.go
48
api/team.go
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/mattermost/platform/model"
|
||||
"github.com/mattermost/platform/store"
|
||||
"github.com/mattermost/platform/utils"
|
||||
"html/template"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
@@ -57,10 +58,16 @@ func signupTeam(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
subjectPage := NewServerTemplatePage("signup_team_subject")
|
||||
subjectPage.Props["SiteURL"] = c.GetSiteURL()
|
||||
bodyPage := NewServerTemplatePage("signup_team_body")
|
||||
subjectPage := NewServerTemplatePage("signup_team_subject", c.Locale)
|
||||
subjectPage.Props["Subject"] = c.T("api.templates.signup_team_subject",
|
||||
map[string]interface{}{"SiteName": utils.ClientCfg["SiteName"]})
|
||||
|
||||
bodyPage := NewServerTemplatePage("signup_team_body", c.Locale)
|
||||
bodyPage.Props["SiteURL"] = c.GetSiteURL()
|
||||
bodyPage.Props["Title"] = c.T("api.templates.signup_team_body.title")
|
||||
bodyPage.Props["Button"] = c.T("api.templates.signup_team_body.button")
|
||||
bodyPage.Html["Info"] = template.HTML(c.T("api.templates.signup_team_body.button",
|
||||
map[string]interface{}{"SiteName": utils.ClientCfg["SiteName"]}))
|
||||
|
||||
props := make(map[string]string)
|
||||
props["email"] = email
|
||||
@@ -427,10 +434,16 @@ func emailTeams(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
subjectPage := NewServerTemplatePage("find_teams_subject")
|
||||
subjectPage.ClientCfg["SiteURL"] = c.GetSiteURL()
|
||||
bodyPage := NewServerTemplatePage("find_teams_body")
|
||||
bodyPage.ClientCfg["SiteURL"] = c.GetSiteURL()
|
||||
siteURL := c.GetSiteURL()
|
||||
subjectPage := NewServerTemplatePage("find_teams_subject", c.Locale)
|
||||
subjectPage.Props["Subject"] = c.T("api.templates.find_teams_subject",
|
||||
map[string]interface{}{"SiteName": utils.ClientCfg["SiteName"]})
|
||||
|
||||
bodyPage := NewServerTemplatePage("find_teams_body", c.Locale)
|
||||
bodyPage.Props["SiteURL"] = siteURL
|
||||
bodyPage.Props["Title"] = c.T("api.templates.find_teams_body.title")
|
||||
bodyPage.Props["Found"] = c.T("api.templates.find_teams_body.found")
|
||||
bodyPage.Props["NotFound"] = c.T("api.templates.find_teams_body.not_found")
|
||||
|
||||
if result := <-Srv.Store.Team().GetTeamsForEmail(email); result.Err != nil {
|
||||
c.Err = result.Err
|
||||
@@ -442,7 +455,7 @@ func emailTeams(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
for _, team := range teams {
|
||||
props[team.Name] = c.GetTeamURLFromTeam(team)
|
||||
}
|
||||
bodyPage.Props = props
|
||||
bodyPage.Extra = props
|
||||
|
||||
if err := utils.SendMail(email, subjectPage.Render(), bodyPage.Render()); err != nil {
|
||||
l4g.Error(utils.T("api.team.email_teams.sending.error"), err)
|
||||
@@ -511,16 +524,19 @@ func InviteMembers(c *Context, team *model.Team, user *model.User, invites []str
|
||||
senderRole = c.T("api.team.invite_members.member")
|
||||
}
|
||||
|
||||
subjectPage := NewServerTemplatePage("invite_subject")
|
||||
subjectPage.Props["SenderName"] = sender
|
||||
subjectPage.Props["TeamDisplayName"] = team.DisplayName
|
||||
subjectPage := NewServerTemplatePage("invite_subject", c.Locale)
|
||||
subjectPage.Props["Subject"] = c.T("api.templates.invite_subject",
|
||||
map[string]interface{}{"SenderName": sender, "TeamDisplayName": team.DisplayName, "SiteName": utils.ClientCfg["SiteName"]})
|
||||
|
||||
bodyPage := NewServerTemplatePage("invite_body")
|
||||
bodyPage := NewServerTemplatePage("invite_body", c.Locale)
|
||||
bodyPage.Props["SiteURL"] = c.GetSiteURL()
|
||||
bodyPage.Props["TeamURL"] = c.GetTeamURL()
|
||||
bodyPage.Props["TeamDisplayName"] = team.DisplayName
|
||||
bodyPage.Props["SenderName"] = sender
|
||||
bodyPage.Props["SenderStatus"] = senderRole
|
||||
bodyPage.Props["Title"] = c.T("api.templates.invite_body.title")
|
||||
bodyPage.Html["Info"] = template.HTML(c.T("api.templates.invite_body.info",
|
||||
map[string]interface{}{"SenderStatus": senderRole, "SenderName": sender, "TeamDisplayName": team.DisplayName}))
|
||||
bodyPage.Props["Button"] = c.T("api.templates.invite_body.button")
|
||||
bodyPage.Html["ExtraInfo"] = template.HTML(c.T("api.templates.invite_body.extra_info",
|
||||
map[string]interface{}{"TeamDisplayName": team.DisplayName, "TeamURL": c.GetTeamURL()}))
|
||||
|
||||
props := make(map[string]string)
|
||||
props["email"] = invite
|
||||
props["id"] = team.Id
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
<table border="0" cellpadding="0" cellspacing="0" style="padding: 20px 50px 0; text-align: center; margin: 0 auto">
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #ddd; padding: 0 0 20px;">
|
||||
<h2 style="font-weight: normal; margin-top: 10px;">You updated your email</h2>
|
||||
<p>You email address for {{.Props.TeamDisplayName}} has been changed to {{.Props.NewEmail}}.<br>If you did not make this change, please contact the system administrator.</p>
|
||||
<h2 style="font-weight: normal; margin-top: 10px;">{{.Props.Title}}</h2>
|
||||
<p>{{.Props.Info}}</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{define "email_change_subject"}}[{{.ClientCfg.SiteName}}] Your email address has changed for {{.Props.TeamDisplayName}}{{end}}
|
||||
{{define "email_change_subject"}}[{{.ClientCfg.SiteName}}] {{.Props.Subject}}{{end}}
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
<table border="0" cellpadding="0" cellspacing="0" style="padding: 20px 50px 0; text-align: center; margin: 0 auto">
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #ddd; padding: 0 0 20px;">
|
||||
<h2 style="font-weight: normal; margin-top: 10px;">You updated your email</h2>
|
||||
<p>To finish updating your email address for {{.Props.TeamDisplayName}}, please click the link below to confirm this is the right address.</p>
|
||||
<h2 style="font-weight: normal; margin-top: 10px;">{{.Props.Title}}</h2>
|
||||
<p>{{.Props.Info}}</p>
|
||||
<p style="margin: 20px 0 15px">
|
||||
<a href="{{.Props.VerifyUrl}}" style="background: #2389D7; border-radius: 3px; color: #fff; border: none; outline: none; min-width: 200px; padding: 15px 25px; font-size: 14px; font-family: inherit; cursor: pointer; -webkit-appearance: none;text-decoration: none;">Verify Email</a>
|
||||
<a href="{{.Props.VerifyUrl}}" style="background: #2389D7; border-radius: 3px; color: #fff; border: none; outline: none; min-width: 200px; padding: 15px 25px; font-size: 14px; font-family: inherit; cursor: pointer; -webkit-appearance: none;text-decoration: none;">{{.Props.VerifyButton}}</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{define "email_change_verify_subject"}}[{{.ClientCfg.SiteName}}] Verify new email address for {{.Props.TeamDisplayName}}{{end}}
|
||||
{{define "email_change_verify_subject"}}[{{.ClientCfg.SiteName}}] {{.Props.Subject}}{{end}}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</p>
|
||||
<p style="padding: 0 50px;">
|
||||
(c) 2015 Mattermost, Inc. 855 El Camino Real, 13A-168, Palo Alto, CA, 94301.<br>
|
||||
To change your notification preferences, log in to your team site and go to Account Settings > Notifications.
|
||||
{{.Props.Footer}}
|
||||
</p>
|
||||
</td>
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
{{define "email_info"}}
|
||||
|
||||
<td style="color: #999; padding-top: 20px; line-height: 25px; font-size: 13px;">
|
||||
Any questions at all, mail us any time: <a href="mailto:{{.ClientCfg.FeedbackEmail}}" style="text-decoration: none; color:#2389D7;">{{.ClientCfg.FeedbackEmail}}</a>.<br>
|
||||
Best wishes,<br>
|
||||
The {{.ClientCfg.SiteName}} Team<br>
|
||||
{{.Html.EmailInfo}}
|
||||
</td>
|
||||
|
||||
{{end}}
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
<div class="container-fluid">
|
||||
<div class="error__container">
|
||||
<div class="error__icon"><i class="fa fa-exclamation-triangle"></i></div>
|
||||
<h2>{{ .ClientCfg.SiteName }} needs your help:</h2>
|
||||
<h2>{{.Props.Title}}</h2>
|
||||
<p>{{ .Props.Message }}</p>
|
||||
<a href="{{.Props.SiteURL}}">Go back to team site</a>
|
||||
<a href="{{.Props.SiteURL}}">{{.Props.Link}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -17,14 +17,14 @@
|
||||
<table border="0" cellpadding="0" cellspacing="0" style="padding: 20px 50px 0; text-align: center; margin: 0 auto">
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #ddd; padding: 0 0 20px;">
|
||||
<h2 style="font-weight: normal; margin-top: 10px;">Finding teams</h2>
|
||||
<p>{{ if .Props }}
|
||||
Your request to find teams associated with your email found the following:<br>
|
||||
{{range $index, $element := .Props}}
|
||||
<h2 style="font-weight: normal; margin-top: 10px;">{{.Props.Title}}</h2>
|
||||
<p>{{ if .Extra }}
|
||||
{{.Props.Found}}<br>
|
||||
{{range $index, $element := .Extra}}
|
||||
<a href="{{ $element }}" style="text-decoration: none; color:#2389D7;">{{ $index }}</a><br>
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
We could not find any teams for the given email.
|
||||
{{.Props.NotFound}}
|
||||
{{ end }}
|
||||
</p>
|
||||
</td>
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{define "find_teams_subject"}}Your {{ .ClientCfg.SiteName }} Teams{{end}}
|
||||
{{define "find_teams_subject"}}{{.Props.Subject}}{{end}}
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
<table border="0" cellpadding="0" cellspacing="0" style="padding: 20px 50px 0; text-align: center; margin: 0 auto">
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #ddd; padding: 0 0 20px;">
|
||||
<h2 style="font-weight: normal; margin-top: 10px;">You've been invited</h2>
|
||||
<p>The team {{.Props.SenderStatus}} <strong>{{.Props.SenderName}}</strong>, has invited you to join <strong>{{.Props.TeamDisplayName}}</strong>.</p>
|
||||
<h2 style="font-weight: normal; margin-top: 10px;">{{.Props.Title}}</h2>
|
||||
<p>{{.Html.Info}}</p>
|
||||
<p style="margin: 30px 0 15px">
|
||||
<a href="{{.Props.Link}}" style="background: #2389D7; border-radius: 3px; color: #fff; border: none; outline: none; min-width: 200px; padding: 15px 25px; font-size: 14px; font-family: inherit; cursor: pointer; -webkit-appearance: none;text-decoration: none;">Join Team</a>
|
||||
<a href="{{.Props.Link}}" style="background: #2389D7; border-radius: 3px; color: #fff; border: none; outline: none; min-width: 200px; padding: 15px 25px; font-size: 14px; font-family: inherit; cursor: pointer; -webkit-appearance: none;text-decoration: none;">{{.Props.Button}}</a>
|
||||
</p>
|
||||
<br/>
|
||||
<p>Mattermost lets you share messages and files from your PC or phone, with instant search and archiving. After you’ve joined <strong>{{.Props.TeamDisplayName}}</strong>, you can sign-in to your new team and access these features anytime from the web address:<br/><br/><a href="{{.Props.TeamURL}}">{{.Props.TeamURL}}</a></p>
|
||||
<p>{{.Html.ExtraInfo}}</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{define "invite_subject"}}{{ .Props.SenderName }} invited you to join {{ .Props.TeamDisplayName }} Team on {{.ClientCfg.SiteName}}{{end}}
|
||||
{{define "invite_subject"}}{{.Props.Subject}}{{end}}
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
<table border="0" cellpadding="0" cellspacing="0" style="padding: 20px 50px 0; text-align: center; margin: 0 auto">
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #ddd; padding: 0 0 20px;">
|
||||
<h2 style="font-weight: normal; margin-top: 10px;">You updated your password</h2>
|
||||
<p>Your password has been updated for {{.Props.TeamDisplayName}} on {{ .Props.TeamURL }} by {{.Props.Method}}.<br>If this change wasn't initiated by you, please contact your system administrator.</p>
|
||||
<h2 style="font-weight: normal; margin-top: 10px;">{{.Props.Title}}</h2>
|
||||
<p>{{.Html.Info}}</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{define "password_change_subject"}}Your password has been updated for {{.Props.TeamDisplayName}} on {{ .ClientCfg.SiteName }}{{end}}
|
||||
{{define "password_change_subject"}}{{.Props.Subject}}{{end}}
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
<table border="0" cellpadding="0" cellspacing="0" style="padding: 20px 50px 0; text-align: center; margin: 0 auto">
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #ddd; padding: 0 0 20px;">
|
||||
<h2 style="font-weight: normal; margin-top: 10px;">You were mentioned</h2>
|
||||
<p>CHANNEL: {{.Props.ChannelName}}<br>{{.Props.SenderName}} - {{.Props.Hour}}:{{.Props.Minute}} {{.Props.TimeZone}}, {{.Props.Month}} {{.Props.Day}}<br><pre style="text-align:left;font-family: 'Lato', sans-serif; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">{{.Props.PostMessage}}</pre></p>
|
||||
<h2 style="font-weight: normal; margin-top: 10px;">{{.Props.BodyText}}</h2>
|
||||
<p>{{.Html.Info}}<br><pre style="text-align:left;font-family: 'Lato', sans-serif; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">{{.Props.PostMessage}}</pre></p>
|
||||
<p style="margin: 20px 0 15px">
|
||||
<a href="{{.Props.TeamLink}}" style="background: #2389D7; display: inline-block; border-radius: 3px; color: #fff; border: none; outline: none; min-width: 170px; padding: 15px 25px; font-size: 14px; font-family: inherit; cursor: pointer; -webkit-appearance: none;text-decoration: none;">Go To Channel</a>
|
||||
<a href="{{.Props.TeamLink}}" style="background: #2389D7; display: inline-block; border-radius: 3px; color: #fff; border: none; outline: none; min-width: 170px; padding: 15px 25px; font-size: 14px; font-family: inherit; cursor: pointer; -webkit-appearance: none;text-decoration: none;">{{.Props.Button}}</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{define "post_subject"}}[{{.ClientCfg.SiteName}}] {{.Props.TeamDisplayName}} Team Notifications for {{.Props.Month}} {{.Props.Day}}, {{.Props.Year}}{{end}}
|
||||
{{define "post_subject"}}[{{.ClientCfg.SiteName}}] {{.Props.Subject}}{{end}}
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
<table border="0" cellpadding="0" cellspacing="0" style="padding: 20px 50px 0; text-align: center; margin: 0 auto">
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #ddd; padding: 0 0 20px;">
|
||||
<h2 style="font-weight: normal; margin-top: 10px;">You requested a password reset</h2>
|
||||
<p>To change your password, click "Reset Password" below.<br>If you did not mean to reset your password, please ignore this email and your password will remain the same.</p>
|
||||
<h2 style="font-weight: normal; margin-top: 10px;">{{.Props.Title}}</h2>
|
||||
<p>{{.Html.Info}}</p>
|
||||
<p style="margin: 20px 0 15px">
|
||||
<a href="{{.Props.ResetUrl}}" style="background: #2389D7; border-radius: 3px; color: #fff; border: none; outline: none; min-width: 200px; padding: 15px 25px; font-size: 14px; font-family: inherit; cursor: pointer; -webkit-appearance: none;text-decoration: none;">Reset Password</a>
|
||||
<a href="{{.Props.ResetUrl}}" style="background: #2389D7; border-radius: 3px; color: #fff; border: none; outline: none; min-width: 200px; padding: 15px 25px; font-size: 14px; font-family: inherit; cursor: pointer; -webkit-appearance: none;text-decoration: none;">{{.Props.Button}}</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{define "reset_subject"}}Reset your password{{end}}
|
||||
{{define "reset_subject"}}{{.Props.Subject}}{{end}}
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
<table border="0" cellpadding="0" cellspacing="0" style="padding: 20px 50px 0; text-align: center; margin: 0 auto">
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #ddd; padding: 0 0 20px;">
|
||||
<h2 style="font-weight: normal; margin-top: 10px;">You updated your sign-in method</h2>
|
||||
<p>You updated your sign-in method for {{.Props.TeamDisplayName}} on {{ .Props.TeamURL }} to {{.Props.Method}}.<br>If this change wasn't initiated by you, please contact your system administrator.</p>
|
||||
<h2 style="font-weight: normal; margin-top: 10px;">{{.Props.Title}}</h2>
|
||||
<p>{{.Html.Info}}</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{define "signin_change_subject"}}You updated your sign-in method for {{.Props.TeamDisplayName}} on {{ .ClientCfg.SiteName }}{{end}}
|
||||
{{define "signin_change_subject"}}{{.Props.Subject}}{{end}}
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
<table border="0" cellpadding="0" cellspacing="0" style="padding: 20px 50px 0; text-align: center; margin: 0 auto">
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #ddd; padding: 0 0 20px;">
|
||||
<h2 style="font-weight: normal; margin-top: 10px;">Thanks for creating a team!</h2>
|
||||
<h2 style="font-weight: normal; margin-top: 10px;">{{.Props.Title}}</h2>
|
||||
<p style="margin: 20px 0 25px">
|
||||
<a href="{{.Props.Link}}" style="background: #2389D7; border-radius: 3px; color: #fff; border: none; outline: none; min-width: 200px; padding: 15px 25px; font-size: 14px; font-family: inherit; cursor: pointer; -webkit-appearance: none;text-decoration: none;">Set up your team</a>
|
||||
<a href="{{.Props.Link}}" style="background: #2389D7; border-radius: 3px; color: #fff; border: none; outline: none; min-width: 200px; padding: 15px 25px; font-size: 14px; font-family: inherit; cursor: pointer; -webkit-appearance: none;text-decoration: none;">{{.Props.Button}}</a>
|
||||
</p>
|
||||
{{ .ClientCfg.SiteName }} is one place for all your team communication, searchable and available anywhere.<br>You'll get more out of {{ .ClientCfg.SiteName }} when your team is in constant communication--let's get them on board.<br></p>
|
||||
{{.Html.Info}}<br></p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{define "signup_team_subject"}}{{ .ClientCfg.SiteName }} Team Setup{{end}}
|
||||
{{define "signup_team_subject"}}{{.Props.Subject}}{{end}}
|
||||
@@ -17,10 +17,10 @@
|
||||
<table border="0" cellpadding="0" cellspacing="0" style="padding: 20px 50px 0; text-align: center; margin: 0 auto">
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #ddd; padding: 0 0 20px;">
|
||||
<h2 style="font-weight: normal; margin-top: 10px;">You've joined the {{ .Props.TeamDisplayName }} team</h2>
|
||||
<p>Please verify your email address by clicking below.</p>
|
||||
<h2 style="font-weight: normal; margin-top: 10px;">{{.Props.Title}}</h2>
|
||||
<p>{{.Props.Info}}</p>
|
||||
<p style="margin: 20px 0 15px">
|
||||
<a href="{{.Props.VerifyUrl}}" style="background: #2389D7; border-radius: 3px; color: #fff; border: none; outline: none; min-width: 200px; padding: 15px 25px; font-size: 14px; font-family: inherit; cursor: pointer; -webkit-appearance: none;text-decoration: none;">Verify Email</a>
|
||||
<a href="{{.Props.VerifyUrl}}" style="background: #2389D7; border-radius: 3px; color: #fff; border: none; outline: none; min-width: 200px; padding: 15px 25px; font-size: 14px; font-family: inherit; cursor: pointer; -webkit-appearance: none;text-decoration: none;">{{.Props.Button}}</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{define "verify_subject"}}[{{ .Props.TeamDisplayName }} {{ .ClientCfg.SiteName }}] Email Verification{{end}}
|
||||
{{define "verify_subject"}}{{.Props.Subject}}{{end}}
|
||||
|
||||
@@ -18,19 +18,19 @@
|
||||
{{if .Props.VerifyUrl }}
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #ddd; padding: 0 0 20px;">
|
||||
<h2 style="font-weight: normal; margin-top: 10px;">You've joined the {{ .Props.TeamDisplayName }} team</h2>
|
||||
<p>Please verify your email address by clicking below.</p>
|
||||
<h2 style="font-weight: normal; margin-top: 10px;">{{.Props.Title}}</h2>
|
||||
<p>{{.Props.Info}}</p>
|
||||
<p style="margin: 20px 0 15px">
|
||||
<a href="{{.Props.VerifyUrl}}" style="background: #2389D7; border-radius: 3px; color: #fff; border: none; outline: none; min-width: 200px; padding: 15px 25px; font-size: 14px; font-family: inherit; cursor: pointer; -webkit-appearance: none;text-decoration: none;">Verify Email</a>
|
||||
<a href="{{.Props.VerifyUrl}}" style="background: #2389D7; border-radius: 3px; color: #fff; border: none; outline: none; min-width: 200px; padding: 15px 25px; font-size: 14px; font-family: inherit; cursor: pointer; -webkit-appearance: none;text-decoration: none;">{{.Props.Button}}</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
{{end}}
|
||||
<tr>
|
||||
<td style="border-bottom: 1px solid #ddd; padding: 0 0 20px;">
|
||||
<h2 style="font-weight: normal; margin-top: 25px; line-height: 1.5;">You can sign-in to your new team from the web address:</h2>
|
||||
<h2 style="font-weight: normal; margin-top: 25px; line-height: 1.5;">{{.Props.Info2}}</h2>
|
||||
<a href="{{.Props.TeamURL}}">{{.Props.TeamURL}}</a>
|
||||
<p>Mattermost lets you share messages and files from your PC or phone, with instant search and archiving.</p>
|
||||
<p>{{.Props.Info3}}</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -1 +1 @@
|
||||
{{define "welcome_subject"}}You joined {{ .Props.TeamDisplayName }}{{end}}
|
||||
{{define "welcome_subject"}}{{.Props.Subject}}{{end}}
|
||||
|
||||
121
api/user.go
121
api/user.go
@@ -17,6 +17,7 @@ import (
|
||||
"github.com/mattermost/platform/utils"
|
||||
"github.com/mssola/user_agent"
|
||||
"hash/fnv"
|
||||
"html/template"
|
||||
"image"
|
||||
"image/color"
|
||||
"image/draw"
|
||||
@@ -134,7 +135,7 @@ func createUser(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if sendWelcomeEmail {
|
||||
sendWelcomeEmailAndForget(ruser.Id, ruser.Email, team.Name, team.DisplayName, c.GetSiteURL(), c.GetTeamURLFromTeam(team), ruser.EmailVerified)
|
||||
sendWelcomeEmailAndForget(c, ruser.Id, ruser.Email, team.Name, team.DisplayName, c.GetSiteURL(), c.GetTeamURLFromTeam(team), ruser.EmailVerified)
|
||||
}
|
||||
|
||||
w.Write([]byte(ruser.ToJson()))
|
||||
@@ -308,13 +309,19 @@ func CreateOAuthUser(c *Context, w http.ResponseWriter, r *http.Request, service
|
||||
return ruser
|
||||
}
|
||||
|
||||
func sendWelcomeEmailAndForget(userId, email, teamName, teamDisplayName, siteURL, teamURL string, verified bool) {
|
||||
func sendWelcomeEmailAndForget(c *Context, userId, email, teamName, teamDisplayName, siteURL, teamURL string, verified bool) {
|
||||
go func() {
|
||||
|
||||
subjectPage := NewServerTemplatePage("welcome_subject")
|
||||
subjectPage.Props["TeamDisplayName"] = teamDisplayName
|
||||
bodyPage := NewServerTemplatePage("welcome_body")
|
||||
subjectPage := NewServerTemplatePage("welcome_subject", c.Locale)
|
||||
subjectPage.Props["Subject"] = c.T("api.templates.welcome_subject", map[string]interface{}{"TeamDisplayName": teamDisplayName})
|
||||
|
||||
bodyPage := NewServerTemplatePage("welcome_body", c.Locale)
|
||||
bodyPage.Props["SiteURL"] = siteURL
|
||||
bodyPage.Props["Title"] = c.T("api.templates.welcome_body.title", map[string]interface{}{"TeamDisplayName": teamDisplayName})
|
||||
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"] = teamURL
|
||||
|
||||
if !verified {
|
||||
@@ -367,18 +374,21 @@ func addDirectChannelsAndForget(user *model.User) {
|
||||
}()
|
||||
}
|
||||
|
||||
func SendVerifyEmailAndForget(userId, userEmail, teamName, teamDisplayName, siteURL, teamURL string) {
|
||||
func SendVerifyEmailAndForget(c *Context, userId, userEmail, teamName, teamDisplayName, siteURL, teamURL string) {
|
||||
go func() {
|
||||
|
||||
link := fmt.Sprintf("%s/verify_email?uid=%s&hid=%s&teamname=%s&email=%s", siteURL, userId, model.HashPassword(userId), teamName, userEmail)
|
||||
|
||||
subjectPage := NewServerTemplatePage("verify_subject")
|
||||
subjectPage.Props["SiteURL"] = siteURL
|
||||
subjectPage.Props["TeamDisplayName"] = teamDisplayName
|
||||
bodyPage := NewServerTemplatePage("verify_body")
|
||||
subjectPage := NewServerTemplatePage("verify_subject", c.Locale)
|
||||
subjectPage.Props["Subject"] = c.T("api.templates.verify_subject",
|
||||
map[string]interface{}{"TeamDisplayName": teamDisplayName, "SiteName": utils.ClientCfg["SiteName"]})
|
||||
|
||||
bodyPage := NewServerTemplatePage("verify_body", c.Locale)
|
||||
bodyPage.Props["SiteURL"] = siteURL
|
||||
bodyPage.Props["TeamDisplayName"] = teamDisplayName
|
||||
bodyPage.Props["Title"] = c.T("api.templates.verify_body.title", map[string]interface{}{"TeamDisplayName": teamDisplayName})
|
||||
bodyPage.Props["Info"] = c.T("api.templates.verify_body.info")
|
||||
bodyPage.Props["VerifyUrl"] = link
|
||||
bodyPage.Props["Button"] = c.T("api.templates.verify_body.button")
|
||||
|
||||
if err := utils.SendMail(userEmail, subjectPage.Render(), bodyPage.Render()); err != nil {
|
||||
l4g.Error(utils.T("api.user.send_verify_email_and_forget.failed.error"), err)
|
||||
@@ -1141,10 +1151,10 @@ func updateUser(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
l4g.Error(tresult.Err.Message)
|
||||
} else {
|
||||
team := tresult.Data.(*model.Team)
|
||||
sendEmailChangeEmailAndForget(rusers[1].Email, rusers[0].Email, team.DisplayName, c.GetTeamURLFromTeam(team), c.GetSiteURL())
|
||||
sendEmailChangeEmailAndForget(c, rusers[1].Email, rusers[0].Email, team.DisplayName, c.GetTeamURLFromTeam(team), c.GetSiteURL())
|
||||
|
||||
if utils.Cfg.EmailSettings.RequireEmailVerification {
|
||||
SendEmailChangeVerifyEmailAndForget(rusers[0].Id, rusers[0].Email, team.Name, team.DisplayName, c.GetSiteURL(), c.GetTeamURLFromTeam(team))
|
||||
SendEmailChangeVerifyEmailAndForget(c, rusers[0].Id, rusers[0].Email, team.Name, team.DisplayName, c.GetSiteURL(), c.GetTeamURLFromTeam(team))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1224,7 +1234,7 @@ func updatePassword(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
l4g.Error(tresult.Err.Message)
|
||||
} else {
|
||||
team := tresult.Data.(*model.Team)
|
||||
sendPasswordChangeEmailAndForget(user.Email, team.DisplayName, c.GetTeamURLFromTeam(team), c.GetSiteURL(), c.T("api.user.update_password.menu"))
|
||||
sendPasswordChangeEmailAndForget(c, user.Email, team.DisplayName, c.GetTeamURLFromTeam(team), c.GetSiteURL(), c.T("api.user.update_password.menu"))
|
||||
}
|
||||
|
||||
data := make(map[string]string)
|
||||
@@ -1526,11 +1536,15 @@ func sendPasswordReset(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
link := fmt.Sprintf("%s/reset_password?d=%s&h=%s", c.GetTeamURLFromTeam(team), url.QueryEscape(data), url.QueryEscape(hash))
|
||||
|
||||
subjectPage := NewServerTemplatePage("reset_subject")
|
||||
subjectPage.Props["SiteURL"] = c.GetSiteURL()
|
||||
bodyPage := NewServerTemplatePage("reset_body")
|
||||
subjectPage := NewServerTemplatePage("reset_subject", c.Locale)
|
||||
subjectPage.Props["Subject"] = c.T("api.templates.reset_subject")
|
||||
|
||||
bodyPage := NewServerTemplatePage("reset_body", c.Locale)
|
||||
bodyPage.Props["SiteURL"] = c.GetSiteURL()
|
||||
bodyPage.Props["Title"] = c.T("api.templates.reset_body.title")
|
||||
bodyPage.Html["Info"] = template.HTML(c.T("api.templates.reset_body.info"))
|
||||
bodyPage.Props["ResetUrl"] = link
|
||||
bodyPage.Props["Button"] = c.T("api.templates.reset_body.button")
|
||||
|
||||
if err := utils.SendMail(email, subjectPage.Render(), bodyPage.Render()); err != nil {
|
||||
c.Err = model.NewLocAppError("sendPasswordReset", "api.user.send_password_reset.send.app_error", nil, "err="+err.Message)
|
||||
@@ -1632,23 +1646,24 @@ func resetPassword(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
c.LogAuditWithUserId(userId, "success")
|
||||
}
|
||||
|
||||
sendPasswordChangeEmailAndForget(user.Email, team.DisplayName, c.GetTeamURLFromTeam(team), c.GetSiteURL(), "using a reset password link")
|
||||
sendPasswordChangeEmailAndForget(c, user.Email, team.DisplayName, c.GetTeamURLFromTeam(team), c.GetSiteURL(), c.T("api.user.reset_password.method"))
|
||||
|
||||
props["new_password"] = ""
|
||||
w.Write([]byte(model.MapToJson(props)))
|
||||
}
|
||||
|
||||
func sendPasswordChangeEmailAndForget(email, teamDisplayName, teamURL, siteURL, method string) {
|
||||
func sendPasswordChangeEmailAndForget(c *Context, email, teamDisplayName, teamURL, siteURL, method string) {
|
||||
go func() {
|
||||
|
||||
subjectPage := NewServerTemplatePage("password_change_subject")
|
||||
subjectPage.Props["SiteURL"] = siteURL
|
||||
subjectPage.Props["TeamDisplayName"] = teamDisplayName
|
||||
bodyPage := NewServerTemplatePage("password_change_body")
|
||||
subjectPage := NewServerTemplatePage("password_change_subject", c.Locale)
|
||||
subjectPage.Props["Subject"] = c.T("api.templates.password_change_subject",
|
||||
map[string]interface{}{"TeamDisplayName": teamDisplayName, "SiteName": utils.ClientCfg["SiteName"]})
|
||||
|
||||
bodyPage := NewServerTemplatePage("password_change_body", c.Locale)
|
||||
bodyPage.Props["SiteURL"] = siteURL
|
||||
bodyPage.Props["TeamDisplayName"] = teamDisplayName
|
||||
bodyPage.Props["TeamURL"] = teamURL
|
||||
bodyPage.Props["Method"] = method
|
||||
bodyPage.Props["Title"] = c.T("api.templates.password_change_body.title")
|
||||
bodyPage.Html["Info"] = template.HTML(c.T("api.templates.password_change_body.info",
|
||||
map[string]interface{}{"TeamDisplayName": teamDisplayName, "TeamURL": teamURL, "Method": method}))
|
||||
|
||||
if err := utils.SendMail(email, subjectPage.Render(), bodyPage.Render()); err != nil {
|
||||
l4g.Error(utils.T("api.user.send_password_change_email_and_forget.error"), err)
|
||||
@@ -1657,17 +1672,18 @@ func sendPasswordChangeEmailAndForget(email, teamDisplayName, teamURL, siteURL,
|
||||
}()
|
||||
}
|
||||
|
||||
func sendEmailChangeEmailAndForget(oldEmail, newEmail, teamDisplayName, teamURL, siteURL string) {
|
||||
func sendEmailChangeEmailAndForget(c *Context, oldEmail, newEmail, teamDisplayName, teamURL, siteURL string) {
|
||||
go func() {
|
||||
|
||||
subjectPage := NewServerTemplatePage("email_change_subject")
|
||||
subjectPage.Props["SiteURL"] = siteURL
|
||||
subjectPage.Props["TeamDisplayName"] = teamDisplayName
|
||||
bodyPage := NewServerTemplatePage("email_change_body")
|
||||
subjectPage := NewServerTemplatePage("email_change_subject", c.Locale)
|
||||
subjectPage.Props["Subject"] = c.T("api.templates.email_change_body",
|
||||
map[string]interface{}{"TeamDisplayName": teamDisplayName})
|
||||
|
||||
bodyPage := NewServerTemplatePage("email_change_body", c.Locale)
|
||||
bodyPage.Props["SiteURL"] = siteURL
|
||||
bodyPage.Props["TeamDisplayName"] = teamDisplayName
|
||||
bodyPage.Props["TeamURL"] = teamURL
|
||||
bodyPage.Props["NewEmail"] = newEmail
|
||||
bodyPage.Props["Title"] = c.T("api.templates.email_change_body.title")
|
||||
bodyPage.Props["Info"] = c.T("api.templates.email_change_body.info",
|
||||
map[string]interface{}{"TeamDisplayName": teamDisplayName, "NewEmail": newEmail})
|
||||
|
||||
if err := utils.SendMail(oldEmail, subjectPage.Render(), bodyPage.Render()); err != nil {
|
||||
l4g.Error(utils.T("api.user.send_email_change_email_and_forget.error"), err)
|
||||
@@ -1676,18 +1692,22 @@ func sendEmailChangeEmailAndForget(oldEmail, newEmail, teamDisplayName, teamURL,
|
||||
}()
|
||||
}
|
||||
|
||||
func SendEmailChangeVerifyEmailAndForget(userId, newUserEmail, teamName, teamDisplayName, siteURL, teamURL string) {
|
||||
func SendEmailChangeVerifyEmailAndForget(c *Context, userId, newUserEmail, teamName, teamDisplayName, siteURL, teamURL string) {
|
||||
go func() {
|
||||
|
||||
link := fmt.Sprintf("%s/verify_email?uid=%s&hid=%s&teamname=%s&email=%s", siteURL, userId, model.HashPassword(userId), teamName, newUserEmail)
|
||||
|
||||
subjectPage := NewServerTemplatePage("email_change_verify_subject")
|
||||
subjectPage.Props["SiteURL"] = siteURL
|
||||
subjectPage.Props["TeamDisplayName"] = teamDisplayName
|
||||
bodyPage := NewServerTemplatePage("email_change_verify_body")
|
||||
subjectPage := NewServerTemplatePage("email_change_verify_subject", c.Locale)
|
||||
subjectPage.Props["Subject"] = c.T("api.templates.email_change_verify_subject",
|
||||
map[string]interface{}{"TeamDisplayName": teamDisplayName})
|
||||
|
||||
bodyPage := NewServerTemplatePage("email_change_verify_body", c.Locale)
|
||||
bodyPage.Props["SiteURL"] = siteURL
|
||||
bodyPage.Props["TeamDisplayName"] = teamDisplayName
|
||||
bodyPage.Props["Title"] = c.T("api.templates.email_change_verify_body.title")
|
||||
bodyPage.Props["Info"] = c.T("api.templates.email_change_verify_body.info",
|
||||
map[string]interface{}{"TeamDisplayName": teamDisplayName})
|
||||
bodyPage.Props["VerifyUrl"] = link
|
||||
bodyPage.Props["VerifyButton"] = c.T("api.templates.email_change_verify_body.button")
|
||||
|
||||
if err := utils.SendMail(newUserEmail, subjectPage.Render(), bodyPage.Render()); err != nil {
|
||||
l4g.Error(utils.T("api.user.send_email_change_verify_email_and_forget.error"), err)
|
||||
@@ -2028,7 +2048,7 @@ func CompleteSwitchWithOAuth(c *Context, w http.ResponseWriter, r *http.Request,
|
||||
return
|
||||
}
|
||||
|
||||
sendSignInChangeEmailAndForget(user.Email, team.DisplayName, c.GetSiteURL()+"/"+team.Name, c.GetSiteURL(), strings.Title(service)+" SSO")
|
||||
sendSignInChangeEmailAndForget(c, user.Email, team.DisplayName, c.GetSiteURL()+"/"+team.Name, c.GetSiteURL(), strings.Title(service)+" SSO")
|
||||
}
|
||||
|
||||
func switchToEmail(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
@@ -2085,7 +2105,7 @@ func switchToEmail(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
sendSignInChangeEmailAndForget(user.Email, team.DisplayName, c.GetSiteURL()+"/"+team.Name, c.GetSiteURL(), "email and password")
|
||||
sendSignInChangeEmailAndForget(c, user.Email, team.DisplayName, c.GetSiteURL()+"/"+team.Name, c.GetSiteURL(), c.T("api.templates.signin_change_email.body.method_email"))
|
||||
|
||||
RevokeAllSession(c, c.Session.UserId)
|
||||
if c.Err != nil {
|
||||
@@ -2099,17 +2119,18 @@ func switchToEmail(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte(model.MapToJson(m)))
|
||||
}
|
||||
|
||||
func sendSignInChangeEmailAndForget(email, teamDisplayName, teamURL, siteURL, method string) {
|
||||
func sendSignInChangeEmailAndForget(c *Context, email, teamDisplayName, teamURL, siteURL, method string) {
|
||||
go func() {
|
||||
|
||||
subjectPage := NewServerTemplatePage("signin_change_subject")
|
||||
subjectPage.Props["SiteURL"] = siteURL
|
||||
subjectPage.Props["TeamDisplayName"] = teamDisplayName
|
||||
bodyPage := NewServerTemplatePage("signin_change_body")
|
||||
subjectPage := NewServerTemplatePage("signin_change_subject", c.Locale)
|
||||
subjectPage.Props["Subject"] = c.T("api.templates.singin_change_email.subject",
|
||||
map[string]interface{}{"TeamDisplayName": teamDisplayName, "SiteName": utils.ClientCfg["SiteName"]})
|
||||
|
||||
bodyPage := NewServerTemplatePage("signin_change_body", c.Locale)
|
||||
bodyPage.Props["SiteURL"] = siteURL
|
||||
bodyPage.Props["TeamDisplayName"] = teamDisplayName
|
||||
bodyPage.Props["TeamURL"] = teamURL
|
||||
bodyPage.Props["Method"] = method
|
||||
bodyPage.Props["Title"] = c.T("api.templates.signin_change_email.body.title")
|
||||
bodyPage.Html["Info"] = template.HTML(c.T("api.templates.singin_change_email.body.info",
|
||||
map[string]interface{}{"TeamDisplayName": teamDisplayName, "TeamURL": teamURL, "Method": method}))
|
||||
|
||||
if err := utils.SendMail(email, subjectPage.Render(), bodyPage.Render()); err != nil {
|
||||
l4g.Error(utils.T("api.user.send_sign_in_change_email_and_forget.error"), err)
|
||||
|
||||
3052
i18n/en.json
3052
i18n/en.json
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
250
i18n/es.json
250
i18n/es.json
@@ -1,7 +1,51 @@
|
||||
[
|
||||
{
|
||||
"id": "",
|
||||
"translation": "Webhooks entrantes han sido deshabilitados por el administrador del sistema."
|
||||
"id": "April",
|
||||
"translation": "Abril"
|
||||
},
|
||||
{
|
||||
"id": "August",
|
||||
"translation": "Agosto"
|
||||
},
|
||||
{
|
||||
"id": "December",
|
||||
"translation": "Diciembre"
|
||||
},
|
||||
{
|
||||
"id": "February",
|
||||
"translation": "Febrero"
|
||||
},
|
||||
{
|
||||
"id": "January",
|
||||
"translation": "Enero"
|
||||
},
|
||||
{
|
||||
"id": "July",
|
||||
"translation": "Julio"
|
||||
},
|
||||
{
|
||||
"id": "June",
|
||||
"translation": "Junio"
|
||||
},
|
||||
{
|
||||
"id": "March",
|
||||
"translation": "Marzo"
|
||||
},
|
||||
{
|
||||
"id": "May",
|
||||
"translation": "Mayo"
|
||||
},
|
||||
{
|
||||
"id": "November",
|
||||
"translation": "Noviembre"
|
||||
},
|
||||
{
|
||||
"id": "October",
|
||||
"translation": "Octubre"
|
||||
},
|
||||
{
|
||||
"id": "September",
|
||||
"translation": "Septiembre"
|
||||
},
|
||||
{
|
||||
"id": "api.admin.file_read_error",
|
||||
@@ -995,6 +1039,198 @@
|
||||
"id": "api.team.update_team.permissions.app_error",
|
||||
"translation": "No tienes los permisos apropiados"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.email_change_body.info",
|
||||
"translation": "Tu dirección de correo electrónico para {{.TeamDisplayName}} ha sido cambiada por {{.NewEmail}}.<br>Si este cambio no fue realizado por ti, por favor contacta un administrador de sistema."
|
||||
},
|
||||
{
|
||||
"id": "api.templates.email_change_body.title",
|
||||
"translation": "Haz actualizado tu correo electrónico"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.email_change_subject",
|
||||
"translation": "Tu dirección de correo para {{.TeamDisplayName}} ha cambiado"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.email_change_verify_body.button",
|
||||
"translation": "Confirmar Correo"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.email_change_verify_body.info",
|
||||
"translation": "Para terminar de actualizar tu dirección de correo para {{.TeamDisplayName}}, por favor pincha en botón de abajo para confirmar que está es la dirección correcta."
|
||||
},
|
||||
{
|
||||
"id": "api.templates.email_change_verify_body.title",
|
||||
"translation": "Haz actualizado tu correo electrónico"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.email_change_verify_subject",
|
||||
"translation": "Verificación de la nueva dirección de correo electrónico para {{.TeamDisplayName}}"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.email_footer",
|
||||
"translation": "Para cambiar tus preferencias de notificaciones, inicia sesión en tu equipo y dirigete a Configurar Cuenta > Notificaciones."
|
||||
},
|
||||
{
|
||||
"id": "api.templates.email_info",
|
||||
"translation": "Si tienes alguna pregunta, escribenos en cualquier momento a: <a href=\"mailto:{{.FeedbackEmail}}\" style=\"text-decoration: none; color:#2389D7;\">{{.FeedbackEmail}}</a>.<br>Los mejores deseos,<br>El Equipo {{.SiteName}}<br>"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.error.link",
|
||||
"translation": "Volver al sitio del equipo"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.error.title",
|
||||
"translation": "Necesitamos de tu ayuda en {{ .SiteName }}:"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.find_teams_body.found",
|
||||
"translation": "Haz solicitado encontrar los equipos a los que tienes asociado tu correo electrónico y encontramos los siguientes:"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.find_teams_body.not_found",
|
||||
"translation": "No hemos podido encontrar ningún equipo asociado al correo electrónico suministrado."
|
||||
},
|
||||
{
|
||||
"id": "api.templates.find_teams_body.title",
|
||||
"translation": "Tus Equipos"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.find_teams_subject",
|
||||
"translation": "Tus equipos de {{ .SiteName }}"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.invite_body.button",
|
||||
"translation": "Unirme al Equipo"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.invite_body.extra_info",
|
||||
"translation": "Mattermost te permite compartir mensajes y archivos de tu Computador o teléfono, incluyendo busquedas instantáneas. Una vez que te hayas unido a <strong>{{.TeamDisplayName}}</strong>, Podrás iniciar sesión en tu nuevo equipo y utilizar todas las características en cualquier momento desde la dirección web:<br/><br/><a href=\"{{.TeamURL}}\">{{.TeamURL}}</a>"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.invite_body.info",
|
||||
"translation": "<strong>{{.SenderName}}</strong> {{.SenderStatus}} del equipo <strong>{{.TeamDisplayName}}</strong>, te ha invitado a unirte."
|
||||
},
|
||||
{
|
||||
"id": "api.templates.invite_body.title",
|
||||
"translation": "Haz sido invitado"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.invite_subject",
|
||||
"translation": "{{ .SenderName }} te ha invitado a unirte al equipo {{ .TeamDisplayName }} en {{.SiteName}}"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.password_change_body.info",
|
||||
"translation": "Tu contraseña ha sido cambiada para {{.TeamDisplayName}} en {{ .TeamURL }} por el método de {{.Method}}.<br>Si este cambio no fue realizado por ti, por favor contacta a un administrador del sistema."
|
||||
},
|
||||
{
|
||||
"id": "api.templates.password_change_body.title",
|
||||
"translation": "Haz cambiado tu contraseña"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.password_change_subject",
|
||||
"translation": "Tu contraseña ha sido cambiada para {{.TeamDisplayName}} en {{ .SiteName }}"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.post_body.button",
|
||||
"translation": "Ir al Canal"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.post_body.info",
|
||||
"translation": "Canal: {{.ChannelName}}<br>{{.SenderName}} - {{.Day}} {{.Month}}, {{.Hour}}:{{.Minute}} {{.TimeZone}}"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.post_subject",
|
||||
"translation": "{{.SubjectText}} en {{.TeamDisplayName}} el {{.Day}} {{.Month}}, {{.Year}}"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.reset_body.button",
|
||||
"translation": "Restablecer Contraseña"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.reset_body.info",
|
||||
"translation": "Para cambiar tu contraseña, pincha el botón \"Restablecer Contraseña\" que se encuentra abajo.<br>Si no fue tu intención restablecer tu contraseña, por favor ignora este correo y tu contraseña seguirá siendo la misma."
|
||||
},
|
||||
{
|
||||
"id": "api.templates.reset_body.title",
|
||||
"translation": "Haz solicitado restablecer tu contraseña"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.reset_subject",
|
||||
"translation": "Restablece tu contraseña"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.signin_change_email.body.method_email",
|
||||
"translation": "correo electrónico y contraseña"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.signin_change_email.body.title",
|
||||
"translation": "Haz actualizado el método con el que inicias sesión"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.signup_team_body.button",
|
||||
"translation": "Configura tu equipo"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.signup_team_body.info",
|
||||
"translation": "{{ .SiteName }} es el lugar para todas las comunicaciones de tu equipo, con capacidades de búsqueda y disponible desde cualquier parte.<br>Podrás aprovechar al máximo {{ .SiteName }} cuando tu equipo esté en constante comunicación--Traigamoslos a bordo."
|
||||
},
|
||||
{
|
||||
"id": "api.templates.signup_team_body.title",
|
||||
"translation": "¡Gracias por haber creado un equipo!"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.signup_team_subject",
|
||||
"translation": "Configuración del equipo en {{ .SiteName }}"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.singin_change_email.body.info",
|
||||
"translation": "Haz actualizado el método con el que inicias sesión en {{.TeamURL}} para el equipo {{.TeamDisplayName}} por {{.Method}}.<br>Si este cambio no fue realizado por ti, por favor contacta a un administrador del sistema."
|
||||
},
|
||||
{
|
||||
"id": "api.templates.singin_change_email.subject",
|
||||
"translation": "Cambio del método de inicio de sesión para {{.TeamDisplayName}} en {{ .SiteName }}"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.verify_body.button",
|
||||
"translation": "Confirmar Correo"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.verify_body.info",
|
||||
"translation": "Por favor verifica tu correo electrónico al pinchar el botón de abajo."
|
||||
},
|
||||
{
|
||||
"id": "api.templates.verify_body.title",
|
||||
"translation": "Te haz unido al equipo {{ .TeamDisplayName }}"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.verify_subject",
|
||||
"translation": "[{{ .TeamDisplayName }} {{ .SiteName }}] Correo de Verificación"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.welcome_body.button",
|
||||
"translation": "Confirmar Correo"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.welcome_body.info",
|
||||
"translation": "Por favor verifica tu correo electrónico al pinchar el botón de abajo."
|
||||
},
|
||||
{
|
||||
"id": "api.templates.welcome_body.info2",
|
||||
"translation": "Puedes iniciar sesión en tu nuevo equipo desde la dirección web:"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.welcome_body.info3",
|
||||
"translation": "Mattermost te permite compartir mensajes y archivos desde un computador o teléfono desde donde te encuentres."
|
||||
},
|
||||
{
|
||||
"id": "api.templates.welcome_body.title",
|
||||
"translation": "Te haz unido al equipo {{ .TeamDisplayName }}"
|
||||
},
|
||||
{
|
||||
"id": "api.templates.welcome_subject",
|
||||
"translation": "Te haz unido a {{ .TeamDisplayName }}"
|
||||
},
|
||||
{
|
||||
"id": "api.user.add_direct_channels_and_forget.failed.error",
|
||||
"translation": "Falla al agragar las preferencias del canal directo para el usuario user_id=%s, team_id=%s, err=%v"
|
||||
@@ -1195,6 +1431,10 @@
|
||||
"id": "api.user.reset_password.link_expired.app_error",
|
||||
"translation": "El enlace para restablecer la contraseña ha expirado"
|
||||
},
|
||||
{
|
||||
"id": "api.user.reset_password.method",
|
||||
"translation": "utilizando el enlace para restablecer contraseña"
|
||||
},
|
||||
{
|
||||
"id": "api.user.reset_password.sso.app_error",
|
||||
"translation": "No se puede restablecer la contraseña para cuentas SSO"
|
||||
@@ -1329,7 +1569,7 @@
|
||||
},
|
||||
{
|
||||
"id": "api.web_conn.new_web_conn.last_ping.error",
|
||||
"translation": "Failed to update LastPingAt for user_id=%v, err=%v"
|
||||
"translation": "Falla al actualizar LastPingAt para el user_id=%v, err=%v"
|
||||
},
|
||||
{
|
||||
"id": "api.web_hub.start.stopping.debug",
|
||||
@@ -1351,6 +1591,10 @@
|
||||
"id": "api.web_team_hun.start.debug",
|
||||
"translation": "deteniendo el hub de equipo para teamId=%v"
|
||||
},
|
||||
{
|
||||
"id": "api.webhook.create_incoming.disabled.app_errror",
|
||||
"translation": "Webhooks entrantes han sido deshabilitados por el administrador del sistema."
|
||||
},
|
||||
{
|
||||
"id": "api.webhook.create_outgoing.disabled.app_error",
|
||||
"translation": "Webhooks de Salida han sido deshabilitados por el administrador del sistema."
|
||||
|
||||
@@ -565,9 +565,9 @@ func verifyEmail(c *api.Context, w http.ResponseWriter, r *http.Request) {
|
||||
user := result.Data.(*model.User)
|
||||
|
||||
if user.LastActivityAt > 0 {
|
||||
api.SendEmailChangeVerifyEmailAndForget(user.Id, user.Email, team.Name, team.DisplayName, c.GetSiteURL(), c.GetTeamURLFromTeam(team))
|
||||
api.SendEmailChangeVerifyEmailAndForget(c, user.Id, user.Email, team.Name, team.DisplayName, c.GetSiteURL(), c.GetTeamURLFromTeam(team))
|
||||
} else {
|
||||
api.SendVerifyEmailAndForget(user.Id, user.Email, team.Name, team.DisplayName, c.GetSiteURL(), c.GetTeamURLFromTeam(team))
|
||||
api.SendVerifyEmailAndForget(c, user.Id, user.Email, team.Name, team.DisplayName, c.GetSiteURL(), c.GetTeamURLFromTeam(team))
|
||||
}
|
||||
|
||||
newAddress := strings.Replace(r.URL.String(), "&resend=true", "&resend_success=true", -1)
|
||||
|
||||
Ссылка в новой задаче
Block a user