From b4be8eb554d4de1de5b4928a37cb72c34d565487 Mon Sep 17 00:00:00 2001 From: Reed Garmsen Date: Mon, 21 Sep 2015 17:03:08 -0700 Subject: Minor changes to how resend status is passed --- web/react/components/email_verify.jsx | 12 +++++++----- web/react/pages/verify.jsx | 1 + web/web.go | 5 +++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/web/react/components/email_verify.jsx b/web/react/components/email_verify.jsx index 4d4d489bb..8d3f15525 100644 --- a/web/react/components/email_verify.jsx +++ b/web/react/components/email_verify.jsx @@ -10,14 +10,14 @@ export default class EmailVerify extends React.Component { this.state = {}; } handleResend() { - const newAddress = window.location.href.replace('?resend_success=true', '').replace('&resend_success=true', ''); + const newAddress = window.location.href.replace('&resend_success=true', ''); window.location.href = newAddress + '&resend=true'; } render() { var title = ''; var body = ''; var resend = ''; - let resendConfirm = ''; + var resendConfirm = ''; if (this.props.isVerified === 'true') { title = global.window.config.SiteName + ' Email Verified'; body =

Your email has been verified! Click -1) { + if (this.props.resendSuccess) { resendConfirm =


{' Verification email sent.'}

; } } @@ -57,10 +57,12 @@ export default class EmailVerify extends React.Component { EmailVerify.defaultProps = { isVerified: 'false', teamURL: '', - userEmail: '' + userEmail: '', + resendSuccess: 'false' }; EmailVerify.propTypes = { isVerified: React.PropTypes.string, teamURL: React.PropTypes.string, - userEmail: React.PropTypes.string + userEmail: React.PropTypes.string, + resendSuccess: React.PropTypes.string }; diff --git a/web/react/pages/verify.jsx b/web/react/pages/verify.jsx index e48471bbd..16a9846e5 100644 --- a/web/react/pages/verify.jsx +++ b/web/react/pages/verify.jsx @@ -9,6 +9,7 @@ global.window.setupVerifyPage = function setupVerifyPage(props) { isVerified={props.IsVerified} teamURL={props.TeamURL} userEmail={props.UserEmail} + resendSuccess={props.ResendSuccess} />, document.getElementById('verify') ); diff --git a/web/web.go b/web/web.go index b204708b0..9d1946283 100644 --- a/web/web.go +++ b/web/web.go @@ -355,6 +355,7 @@ func getChannel(c *api.Context, w http.ResponseWriter, r *http.Request) { func verifyEmail(c *api.Context, w http.ResponseWriter, r *http.Request) { resend := r.URL.Query().Get("resend") + resendSuccess := r.URL.Query().Get("resend_success") name := r.URL.Query().Get("teamname") email := r.URL.Query().Get("email") hashedId := r.URL.Query().Get("hid") @@ -376,8 +377,7 @@ func verifyEmail(c *api.Context, w http.ResponseWriter, r *http.Request) { user := result.Data.(*model.User) api.FireAndForgetVerifyEmail(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) - newAddress = strings.Replace(newAddress, "&resend=true", "&resend_success=true", -1) + newAddress := strings.Replace(r.URL.String(), "&resend=true", "&resend_success=true", -1) http.Redirect(w, r, newAddress, http.StatusFound) return } @@ -403,6 +403,7 @@ func verifyEmail(c *api.Context, w http.ResponseWriter, r *http.Request) { page.Props["IsVerified"] = isVerified page.Props["TeamURL"] = c.GetTeamURLFromTeam(team) page.Props["UserEmail"] = email + page.Props["ResendSuccess"] = resendSuccess page.Render(c, w) } -- cgit v1.2.3-1-g7c22