diff options
author | Reed Garmsen <rgarmsen2295@gmail.com> | 2015-10-06 08:58:31 -0700 |
---|---|---|
committer | Reed Garmsen <rgarmsen2295@gmail.com> | 2015-10-06 09:15:56 -0700 |
commit | c84fe62ca199485dccefc37e00ca2bef45d47c6d (patch) | |
tree | 8e60c594e261e391b6a1e0bc36361a7393caa23f /api | |
parent | f85dc7f575a9aad45d7914279300a22e9a6fae8a (diff) | |
download | chat-c84fe62ca199485dccefc37e00ca2bef45d47c6d.tar.gz chat-c84fe62ca199485dccefc37e00ca2bef45d47c6d.tar.bz2 chat-c84fe62ca199485dccefc37e00ca2bef45d47c6d.zip |
Added new email to email change notification
Diffstat (limited to 'api')
-rw-r--r-- | api/templates/email_change_body.html | 2 | ||||
-rw-r--r-- | api/user.go | 11 |
2 files changed, 7 insertions, 6 deletions
diff --git a/api/templates/email_change_body.html b/api/templates/email_change_body.html index 7addb6f35..5c5f6c777 100644 --- a/api/templates/email_change_body.html +++ b/api/templates/email_change_body.html @@ -18,7 +18,7 @@ <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.<br>If you did not make this change, please contact the system administrator.</p> + <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> </td> </tr> <tr> diff --git a/api/user.go b/api/user.go index 13292c434..4d12f0f33 100644 --- a/api/user.go +++ b/api/user.go @@ -887,7 +887,7 @@ func updateUser(c *Context, w http.ResponseWriter, r *http.Request) { l4g.Error(tresult.Err.Message) } else { team := tresult.Data.(*model.Team) - fireAndForgetEmailChangeEmail(rusers[1].Email, team.DisplayName, c.GetTeamURLFromTeam(team), c.GetSiteURL()) + fireAndForgetEmailChangeEmail(rusers[1].Email, rusers[0].Email, team.DisplayName, c.GetTeamURLFromTeam(team), c.GetSiteURL()) if utils.Cfg.EmailSettings.RequireEmailVerification { FireAndForgetEmailChangeVerifyEmail(rusers[0].Id, rusers[0].Email, team.Name, team.DisplayName, c.GetSiteURL(), c.GetTeamURLFromTeam(team)) @@ -1326,7 +1326,7 @@ func fireAndForgetPasswordChangeEmail(email, teamDisplayName, teamURL, siteURL, }() } -func fireAndForgetEmailChangeEmail(email, teamDisplayName, teamURL, siteURL string) { +func fireAndForgetEmailChangeEmail(oldEmail, newEmail, teamDisplayName, teamURL, siteURL string) { go func() { subjectPage := NewServerTemplatePage("email_change_subject") @@ -1336,9 +1336,10 @@ func fireAndForgetEmailChangeEmail(email, teamDisplayName, teamURL, siteURL stri bodyPage.Props["SiteURL"] = siteURL bodyPage.Props["TeamDisplayName"] = teamDisplayName bodyPage.Props["TeamURL"] = teamURL + bodyPage.Props["NewEmail"] = newEmail - if err := utils.SendMail(email, subjectPage.Render(), bodyPage.Render()); err != nil { - l4g.Error("Failed to send update password email successfully err=%v", err) + if err := utils.SendMail(oldEmail, subjectPage.Render(), bodyPage.Render()); err != nil { + l4g.Error("Failed to send email change notification email successfully err=%v", err) } }() @@ -1358,7 +1359,7 @@ func FireAndForgetEmailChangeVerifyEmail(userId, newUserEmail, teamName, teamDis bodyPage.Props["VerifyUrl"] = link if err := utils.SendMail(newUserEmail, subjectPage.Render(), bodyPage.Render()); err != nil { - l4g.Error("Failed to send verification email successfully err=%v", err) + l4g.Error("Failed to send email change verification email successfully err=%v", err) } }() } |