From 252d0f3924dd19aa4dd1900c6c00c41c84755d1e Mon Sep 17 00:00:00 2001
From: =Corey Hulen <corey@hulen.com>
Date: Sun, 12 Jul 2015 23:36:52 -0800
Subject: Fixes mm-1415 adding email bypass flag

---
 web/react/components/signup_user_complete.jsx | 33 +++++++++++++--------------
 1 file changed, 16 insertions(+), 17 deletions(-)

(limited to 'web/react/components/signup_user_complete.jsx')

diff --git a/web/react/components/signup_user_complete.jsx b/web/react/components/signup_user_complete.jsx
index fb96cc99f..ef1eb1c62 100644
--- a/web/react/components/signup_user_complete.jsx
+++ b/web/react/components/signup_user_complete.jsx
@@ -46,25 +46,24 @@ module.exports = React.createClass({
             function(data) {
                 client.track('signup', 'signup_user_02_complete');
 
-                if (data.email_verified) {
-                    client.loginByEmail(this.props.domain, this.state.user.email, this.state.user.password,
-                        function(data) {
-                            UserStore.setLastDomain(this.props.domain);
-                            UserStore.setLastEmail(this.state.user.email);
-                            UserStore.setCurrentUser(data);
-                            if (this.props.hash > 0)
-                                BrowserStore.setGlobalItem(this.props.hash, JSON.stringify({wizard: "finished"}));
-                            window.location.href = '/channels/town-square';
-                        }.bind(this),
-                        function(err) {
+                client.loginByEmail(this.props.domain, this.state.user.email, this.state.user.password,
+                    function(data) {
+                        UserStore.setLastDomain(this.props.domain);
+                        UserStore.setLastEmail(this.state.user.email);
+                        UserStore.setCurrentUser(data);
+                        if (this.props.hash > 0)
+                            BrowserStore.setGlobalItem(this.props.hash, JSON.stringify({wizard: "finished"}));
+                        window.location.href = '/channels/town-square';
+                    }.bind(this),
+                    function(err) {
+                        if (err.message == "Login failed because email address has not been verified") {
+                            window.location.href = "/verify?email="+ encodeURIComponent(this.state.user.email) + "&domain=" + encodeURIComponent(this.props.domain);
+                        } else {
                             this.state.server_error = err.message;
                             this.setState(this.state);
-                        }.bind(this)
-                    );
-                }
-                else {
-                    window.location.href = "/verify?email="+ encodeURIComponent(this.state.user.email) + "&domain=" + encodeURIComponent(this.props.domain);
-                }
+                        }
+                    }.bind(this)
+                );
             }.bind(this),
             function(err) {
                 this.state.server_error = err.message;
-- 
cgit v1.2.3-1-g7c22

