PLT-602 combining welcome and verify email
Этот коммит содержится в:
@@ -15,6 +15,17 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<table border="0" cellpadding="0" cellspacing="0" style="padding: 20px 50px 0; text-align: center; margin: 0 auto">
|
<table border="0" cellpadding="0" cellspacing="0" style="padding: 20px 50px 0; text-align: center; margin: 0 auto">
|
||||||
|
{{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 been invited</h2>
|
||||||
|
<p>Please verify your email address by clicking below.</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>
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{end}}
|
||||||
<tr>
|
<tr>
|
||||||
<td style="border-bottom: 1px solid #ddd; padding: 0 0 20px;">
|
<td style="border-bottom: 1px solid #ddd; padding: 0 0 20px;">
|
||||||
<h2 style="font-weight: normal; margin-top: 10px;">You can sign-in to your new team from the web address:</h2>
|
<h2 style="font-weight: normal; margin-top: 10px;">You can sign-in to your new team from the web address:</h2>
|
||||||
|
|||||||
13
api/user.go
13
api/user.go
@@ -198,13 +198,12 @@ func CreateUser(c *Context, team *model.Team, user *model.User) *model.User {
|
|||||||
l4g.Error("Encountered an issue joining default channels user_id=%s, team_id=%s, err=%v", ruser.Id, ruser.TeamId, err)
|
l4g.Error("Encountered an issue joining default channels user_id=%s, team_id=%s, err=%v", ruser.Id, ruser.TeamId, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
fireAndForgetWelcomeEmail(ruser.Email, team.DisplayName, c.GetSiteURL(), c.GetTeamURLFromTeam(team))
|
fireAndForgetWelcomeEmail(result.Data.(*model.User).Id, ruser.Email, team.Name, team.DisplayName, c.GetSiteURL(), c.GetTeamURLFromTeam(team), user.EmailVerified)
|
||||||
|
|
||||||
if user.EmailVerified {
|
if user.EmailVerified {
|
||||||
if cresult := <-Srv.Store.User().VerifyEmail(ruser.Id); cresult.Err != nil {
|
if cresult := <-Srv.Store.User().VerifyEmail(ruser.Id); cresult.Err != nil {
|
||||||
l4g.Error("Failed to set email verified err=%v", cresult.Err)
|
l4g.Error("Failed to set email verified err=%v", cresult.Err)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
FireAndForgetVerifyEmail(result.Data.(*model.User).Id, ruser.Email, team.Name, team.DisplayName, c.GetSiteURL(), c.GetTeamURLFromTeam(team))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ruser.Sanitize(map[string]bool{})
|
ruser.Sanitize(map[string]bool{})
|
||||||
@@ -218,7 +217,7 @@ func CreateUser(c *Context, team *model.Team, user *model.User) *model.User {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func fireAndForgetWelcomeEmail(email, teamDisplayName, siteURL, teamURL string) {
|
func fireAndForgetWelcomeEmail(userId, email, teamName, teamDisplayName, siteURL, teamURL string, verified bool) {
|
||||||
go func() {
|
go func() {
|
||||||
|
|
||||||
subjectPage := NewServerTemplatePage("welcome_subject")
|
subjectPage := NewServerTemplatePage("welcome_subject")
|
||||||
@@ -227,10 +226,14 @@ func fireAndForgetWelcomeEmail(email, teamDisplayName, siteURL, teamURL string)
|
|||||||
bodyPage.Props["SiteURL"] = siteURL
|
bodyPage.Props["SiteURL"] = siteURL
|
||||||
bodyPage.Props["TeamURL"] = teamURL
|
bodyPage.Props["TeamURL"] = teamURL
|
||||||
|
|
||||||
|
if !verified {
|
||||||
|
link := fmt.Sprintf("%s/verify_email?uid=%s&hid=%s&teamname=%s&email=%s", siteURL, userId, model.HashPassword(userId), teamName, email)
|
||||||
|
bodyPage.Props["VerifyUrl"] = link
|
||||||
|
}
|
||||||
|
|
||||||
if err := utils.SendMail(email, subjectPage.Render(), bodyPage.Render()); err != nil {
|
if err := utils.SendMail(email, subjectPage.Render(), bodyPage.Render()); err != nil {
|
||||||
l4g.Error("Failed to send welcome email successfully err=%v", err)
|
l4g.Error("Failed to send welcome email successfully err=%v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user