From ca3211bc04f6dea34e8168217182637d1419f998 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Thu, 2 Feb 2017 09:31:00 -0500 Subject: PLT-5328 Fixing signup screen (#5247) * Fixing signup screen not forwarding properly * Fixing team id not forwarding from invite link if only LDAP is enabled --- webapp/actions/user_actions.jsx | 20 +------------------- webapp/components/signup/components/signup_email.jsx | 19 +++++++++++++++++-- webapp/components/signup/signup_controller.jsx | 2 +- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/webapp/actions/user_actions.jsx b/webapp/actions/user_actions.jsx index 55b143d34..94777bc45 100644 --- a/webapp/actions/user_actions.jsx +++ b/webapp/actions/user_actions.jsx @@ -4,12 +4,10 @@ import AppDispatcher from 'dispatcher/app_dispatcher.jsx'; import PreferenceStore from 'stores/preference_store.jsx'; -import BrowserStore from 'stores/browser_store.jsx'; import TeamStore from 'stores/team_store.jsx'; import UserStore from 'stores/user_store.jsx'; import ChannelStore from 'stores/channel_store.jsx'; -import * as GlobalActions from 'actions/global_actions.jsx'; import {getChannelMembersForUserIds} from 'actions/channel_actions.jsx'; import {loadStatusesForProfilesList, loadStatusesForProfilesMap} from 'actions/status_actions.jsx'; @@ -637,28 +635,12 @@ export function resendVerification(email, success, error) { ); } -export function loginById(userId, password, mfaToken, hash, success, error) { +export function loginById(userId, password, mfaToken, success, error) { Client.loginById( userId, password, mfaToken, - hash, () => { - if (hash > 0) { - BrowserStore.setGlobalItem(hash, JSON.stringify({usedBefore: true})); - } - - GlobalActions.emitInitialLoad( - () => { - const query = this.props.location.query; - if (query.redirect_to) { - browserHistory.push(query.redirect_to); - } else { - GlobalActions.redirectUserToDefaultTeam(); - } - } - ); - if (success) { success(); } diff --git a/webapp/components/signup/components/signup_email.jsx b/webapp/components/signup/components/signup_email.jsx index 9ed10b94c..def5715ae 100644 --- a/webapp/components/signup/components/signup_email.jsx +++ b/webapp/components/signup/components/signup_email.jsx @@ -4,6 +4,7 @@ import LoadingScreen from 'components/loading_screen.jsx'; import * as GlobalActions from 'actions/global_actions.jsx'; +import BrowserStore from 'stores/browser_store.jsx'; import {track} from 'actions/analytics_actions.jsx'; import {getInviteInfo} from 'actions/team_actions.jsx'; import {loginById, createUserWithInvite} from 'actions/user_actions.jsx'; @@ -121,8 +122,22 @@ export default class SignupEmail extends React.Component { data.id, user.password, '', - this.state.hash, - null, + () => { + if (this.state.hash > 0) { + BrowserStore.setGlobalItem(this.state.hash, JSON.stringify({usedBefore: true})); + } + + GlobalActions.emitInitialLoad( + () => { + const query = this.props.location.query; + if (query.redirect_to) { + browserHistory.push(query.redirect_to); + } else { + GlobalActions.redirectUserToDefaultTeam(); + } + } + ); + }, (err) => { if (err.id === 'api.user.login.not_verified.app_error') { browserHistory.push('/should_verify_email?email=' + encodeURIComponent(user.email) + '&teamname=' + encodeURIComponent(this.state.teamName)); diff --git a/webapp/components/signup/signup_controller.jsx b/webapp/components/signup/signup_controller.jsx index 737431926..4facbc60d 100644 --- a/webapp/components/signup/signup_controller.jsx +++ b/webapp/components/signup/signup_controller.jsx @@ -266,7 +266,7 @@ export default class SignupController extends React.Component { if (global.window.mm_config.EnableSignUpWithEmail === 'true') { return browserHistory.push('/signup_email' + window.location.search); } else if (global.window.mm_license.IsLicensed === 'true' && global.window.mm_config.EnableLdap === 'true') { - return browserHistory.push('/signup_ldap'); + return browserHistory.push('/signup_ldap' + window.location.search); } } -- cgit v1.2.3-1-g7c22