From b62e29ba9cd6183551266da05b9b602a4415d738 Mon Sep 17 00:00:00 2001
From: Christopher Speller <crspeller@gmail.com>
Date: Thu, 24 Mar 2016 11:05:13 -0400
Subject: Moving all links and redirects to react-router

---
 webapp/components/login.jsx | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

(limited to 'webapp/components/login.jsx')

diff --git a/webapp/components/login.jsx b/webapp/components/login.jsx
index a60303d11..ad30f0619 100644
--- a/webapp/components/login.jsx
+++ b/webapp/components/login.jsx
@@ -11,7 +11,7 @@ import Constants from 'utils/constants.jsx';
 import TeamStore from 'stores/team_store.jsx';
 
 import {FormattedMessage} from 'react-intl';
-import {browserHistory} from 'react-router';
+import {browserHistory, Link} from 'react-router';
 
 import React from 'react';
 
@@ -57,10 +57,10 @@ export default class Login extends React.Component {
         let loginMessage = [];
         if (global.window.mm_config.EnableSignUpWithGitLab === 'true') {
             loginMessage.push(
-                <a
+                <Link
                     className='btn btn-custom-login gitlab'
                     key='gitlab'
-                    href={'/api/v1/oauth/gitlab/login?team=' + encodeURIComponent(teamName)}
+                    to={'/api/v1/oauth/gitlab/login?team=' + encodeURIComponent(teamName)}
                 >
                     <span className='icon'/>
                     <span>
@@ -69,16 +69,16 @@ export default class Login extends React.Component {
                             defaultMessage='with GitLab'
                         />
                     </span>
-                </a>
+                </Link>
             );
         }
 
         if (global.window.mm_config.EnableSignUpWithGoogle === 'true') {
             loginMessage.push(
-                <a
+                <Link
                     className='btn btn-custom-login google'
                     key='google'
-                    href={'/api/v1/oauth/google/login?team=' + encodeURIComponent(teamName)}
+                    to={'/api/v1/oauth/google/login?team=' + encodeURIComponent(teamName)}
                 >
                     <span className='icon'/>
                     <span>
@@ -87,7 +87,7 @@ export default class Login extends React.Component {
                             defaultMessage='with Google Apps'
                         />
                     </span>
-                </a>
+                </Link>
             );
         }
 
@@ -154,12 +154,12 @@ export default class Login extends React.Component {
         if (emailSignup) {
             forgotPassword = (
                 <div className='form-group'>
-                    <a href={'/' + teamName + '/reset_password'}>
+                    <Link to={'/' + teamName + '/reset_password'}>
                         <FormattedMessage
                             id='login.forgot'
                             defaultMessage='I forgot my password'
                         />
-                    </a>
+                    </Link>
                 </div>
             );
         }
@@ -173,15 +173,15 @@ export default class Login extends React.Component {
                             id='login.noAccount'
                             defaultMessage="Don't have an account? "
                         />
-                        <a
-                            href={'/signup_user_complete/?id=' + currentTeam.invite_id}
+                        <Link
+                            to={'/signup_user_complete/?id=' + currentTeam.invite_id}
                             className='signup-team-login'
                         >
                             <FormattedMessage
                                 id='login.create'
                                 defaultMessage='Create one now'
                             />
-                        </a>
+                        </Link>
                     </span>
                 </div>
             );
@@ -191,15 +191,15 @@ export default class Login extends React.Component {
         if (global.window.mm_config.EnableTeamCreation === 'true' && !Utils.isMobileApp()) {
             teamSignUp = (
                 <div className='margin--extra'>
-                    <a
-                        href='/'
+                    <Link
+                        to='/'
                         className='signup-team-login'
                     >
                         <FormattedMessage
                             id='login.createTeam'
                             defaultMessage='Create a new team'
                         />
-                    </a>
+                    </Link>
                 </div>
             );
         }
@@ -257,12 +257,12 @@ export default class Login extends React.Component {
         return (
             <div>
                 <div className='signup-header'>
-                    <a href='/'>
+                    <Link to='/'>
                         <span className='fa fa-chevron-left'/>
                         <FormattedMessage
                             id='web.header.back'
                         />
-                    </a>
+                    </Link>
                 </div>
                 <div className='col-sm-12'>
                     <div className='signup-team__container'>
-- 
cgit v1.2.3-1-g7c22


From d6a6668a39db2f78d59919686c5d7b901888da36 Mon Sep 17 00:00:00 2001
From: Christopher Speller <crspeller@gmail.com>
Date: Thu, 24 Mar 2016 11:27:05 -0400
Subject: Modifying login not to display until it has finished checking. Caused
 admin console to redirect to town-square. Will be changed after user model
 flip.

---
 webapp/components/login.jsx | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'webapp/components/login.jsx')

diff --git a/webapp/components/login.jsx b/webapp/components/login.jsx
index ad30f0619..e8180895d 100644
--- a/webapp/components/login.jsx
+++ b/webapp/components/login.jsx
@@ -29,6 +29,8 @@ export default class Login extends React.Component {
         Client.getMeLoggedIn((data) => {
             if (data && data.logged_in !== 'false') {
                 browserHistory.push('/' + this.props.params.team + '/channels/town-square');
+            } else {
+                this.setState({doneCheckLogin: true}); //eslint-disable-line react/no-did-mount-set-state
             }
         });
     }
@@ -37,7 +39,8 @@ export default class Login extends React.Component {
     }
     getStateFromStores() {
         return {
-            currentTeam: TeamStore.getByName(this.props.params.team)
+            currentTeam: TeamStore.getByName(this.props.params.team),
+            doneCheckLogin: false
         };
     }
     onTeamChange() {
@@ -45,7 +48,7 @@ export default class Login extends React.Component {
     }
     render() {
         const currentTeam = this.state.currentTeam;
-        if (currentTeam == null) {
+        if (currentTeam == null || !this.state.doneCheckLogin) {
             return <div/>;
         }
 
-- 
cgit v1.2.3-1-g7c22

