summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2015-10-14 08:27:34 -0400
committerChristopher Speller <crspeller@gmail.com>2015-10-14 08:27:34 -0400
commitcdbe6342bb018e16d6eb3f04c0c6c8457805e61a (patch)
treece22f6283ab9e59cc6d14573eae547f38b009ad0 /api
parentcbefd8895107c3f168c97c5676ad0b19c0254d10 (diff)
parent4ad9e0673ca8950597a290f10db10475b18b67cc (diff)
downloadchat-cdbe6342bb018e16d6eb3f04c0c6c8457805e61a.tar.gz
chat-cdbe6342bb018e16d6eb3f04c0c6c8457805e61a.tar.bz2
chat-cdbe6342bb018e16d6eb3f04c0c6c8457805e61a.zip
Merge release branch 'release-1.1.0'
Diffstat (limited to 'api')
-rw-r--r--api/templates/welcome_body.html11
-rw-r--r--api/user.go13
2 files changed, 19 insertions, 5 deletions
diff --git a/api/templates/welcome_body.html b/api/templates/welcome_body.html
index 94b597cbb..b7cb3704d 100644
--- a/api/templates/welcome_body.html
+++ b/api/templates/welcome_body.html
@@ -15,6 +15,17 @@
<tr>
<td>
<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>
<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>
diff --git a/api/user.go b/api/user.go
index faf828cf9..146ede015 100644
--- a/api/user.go
+++ b/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)
}
- 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 cresult := <-Srv.Store.User().VerifyEmail(ruser.Id); cresult.Err != nil {
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{})
@@ -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() {
subjectPage := NewServerTemplatePage("welcome_subject")
@@ -227,10 +226,14 @@ func fireAndForgetWelcomeEmail(email, teamDisplayName, siteURL, teamURL string)
bodyPage.Props["SiteURL"] = siteURL
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 {
l4g.Error("Failed to send welcome email successfully err=%v", err)
}
-
}()
}