diff options
author | Reed Garmsen <rgarmsen2295@gmail.com> | 2015-09-21 16:03:18 -0700 |
---|---|---|
committer | Reed Garmsen <rgarmsen2295@gmail.com> | 2015-09-21 16:03:18 -0700 |
commit | dda30e407aca321f369f27078076d3e05fd28b19 (patch) | |
tree | 1210d0ae8969c3e51918cd0ccab425e458f3c278 /web | |
parent | ee5a77ec56ee13f5eb96fce6065b4b7a1845de89 (diff) | |
download | chat-dda30e407aca321f369f27078076d3e05fd28b19.tar.gz chat-dda30e407aca321f369f27078076d3e05fd28b19.tar.bz2 chat-dda30e407aca321f369f27078076d3e05fd28b19.zip |
Added confirmation when users request another verification email; users are no longer redirected after requesting another verification email
Diffstat (limited to 'web')
-rw-r--r-- | web/react/components/email_verify.jsx | 8 | ||||
-rw-r--r-- | web/web.go | 5 |
2 files changed, 11 insertions, 2 deletions
diff --git a/web/react/components/email_verify.jsx b/web/react/components/email_verify.jsx index 92123956f..4d4d489bb 100644 --- a/web/react/components/email_verify.jsx +++ b/web/react/components/email_verify.jsx @@ -10,12 +10,14 @@ export default class EmailVerify extends React.Component { this.state = {}; } handleResend() { - window.location.href = window.location.href + '&resend=true'; + const newAddress = window.location.href.replace('?resend_success=true', '').replace('&resend_success=true', ''); + window.location.href = newAddress + '&resend=true'; } render() { var title = ''; var body = ''; var resend = ''; + let resendConfirm = ''; if (this.props.isVerified === 'true') { title = global.window.config.SiteName + ' Email Verified'; body = <p>Your email has been verified! Click <a href={this.props.teamURL + '?email=' + this.props.userEmail}>here</a> to log in.</p>; @@ -30,6 +32,9 @@ export default class EmailVerify extends React.Component { Resend Email </button> ); + if (window.location.href.indexOf('resend_success=true') > -1) { + resendConfirm = <div><br /><p className='alert alert-success'><i className='fa fa-check'></i>{' Verification email sent.'}</p></div>; + } } return ( @@ -41,6 +46,7 @@ export default class EmailVerify extends React.Component { <div className='panel-body'> {body} {resend} + {resendConfirm} </div> </div> </div> diff --git a/web/web.go b/web/web.go index 305e4f199..b204708b0 100644 --- a/web/web.go +++ b/web/web.go @@ -375,7 +375,10 @@ func verifyEmail(c *api.Context, w http.ResponseWriter, r *http.Request) { } else { user := result.Data.(*model.User) api.FireAndForgetVerifyEmail(user.Id, user.Email, team.Name, team.DisplayName, c.GetSiteURL(), c.GetTeamURLFromTeam(team)) - http.Redirect(w, r, "/", http.StatusFound) + + newAddress := strings.Replace(r.URL.String(), "?resend=true", "?resend_success=true", -1) + newAddress = strings.Replace(newAddress, "&resend=true", "&resend_success=true", -1) + http.Redirect(w, r, newAddress, http.StatusFound) return } } |