From 4311978d650fa1e40f34db3c2cb411377bcc6936 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Tue, 6 Oct 2015 09:12:49 -0400 Subject: Combining email verification confirmation screen with login screen. --- web/react/components/email_verify.jsx | 4 ++-- web/react/components/login.jsx | 12 ++++++++++++ web/sass-files/sass/partials/_signup.scss | 5 +++++ web/templates/verify.html | 25 +++++++++++++++---------- web/web.go | 15 ++++----------- 5 files changed, 38 insertions(+), 23 deletions(-) (limited to 'web') diff --git a/web/react/components/email_verify.jsx b/web/react/components/email_verify.jsx index 8d3f15525..391de3326 100644 --- a/web/react/components/email_verify.jsx +++ b/web/react/components/email_verify.jsx @@ -38,8 +38,8 @@ export default class EmailVerify extends React.Component { } return ( -
-
+
+

{title}

diff --git a/web/react/components/login.jsx b/web/react/components/login.jsx index 70f7a5d6e..54df75cbc 100644 --- a/web/react/components/login.jsx +++ b/web/react/components/login.jsx @@ -112,6 +112,17 @@ export default class Login extends React.Component { errorClass = ' has-error'; } + const verifiedParam = Utils.getUrlParameter('verified'); + let verifiedBox = ''; + if (verifiedParam) { + verifiedBox = ( +
+ + {' Email Verified'} +
+ ); + } + let emailSignup; if (global.window.config.EnableSignUpWithEmail === 'true') { emailSignup = ( @@ -175,6 +186,7 @@ export default class Login extends React.Component {

{teamDisplayName}

on {global.window.config.SiteName}

+ {verifiedBox}
{serverError}
diff --git a/web/sass-files/sass/partials/_signup.scss b/web/sass-files/sass/partials/_signup.scss index 924f0718a..48f8adf4e 100644 --- a/web/sass-files/sass/partials/_signup.scss +++ b/web/sass-files/sass/partials/_signup.scss @@ -330,3 +330,8 @@ .authorize-btn { margin-right: 6px; } + +.verify_panel { + margin: 60px auto auto auto; + max-width: 380px; +} diff --git a/web/templates/verify.html b/web/templates/verify.html index cb4832512..a49ba7930 100644 --- a/web/templates/verify.html +++ b/web/templates/verify.html @@ -1,16 +1,21 @@ {{define "verify"}} -{{template "head" . }} - -
-
-
+ {{template "head" . }} + +
+
+
+
+
+ +
-
- - + + {{end}} diff --git a/web/web.go b/web/web.go index a1bbf5a81..b87636187 100644 --- a/web/web.go +++ b/web/web.go @@ -422,24 +422,17 @@ func verifyEmail(c *api.Context, w http.ResponseWriter, r *http.Request) { } } - var isVerified string - if len(userId) != 26 { - isVerified = "false" - } else if len(hashedId) == 0 { - isVerified = "false" - } else if model.ComparePassword(hashedId, userId) { - isVerified = "true" + if len(userId) == 26 && len(hashedId) != 0 && model.ComparePassword(hashedId, userId) { if c.Err = (<-api.Srv.Store.User().VerifyEmail(userId)).Err; c.Err != nil { return } else { - c.LogAudit("") + c.LogAudit("Email Verified") + http.Redirect(w, r, api.GetProtocol(r)+"://"+r.Host+"/"+name+"/login?verified=true&email="+email, http.StatusTemporaryRedirect) + return } - } else { - isVerified = "false" } page := NewHtmlTemplatePage("verify", "Email Verified") - page.Props["IsVerified"] = isVerified page.Props["TeamURL"] = c.GetTeamURLFromTeam(team) page.Props["UserEmail"] = email page.Props["ResendSuccess"] = resendSuccess -- cgit v1.2.3-1-g7c22