diff options
Diffstat (limited to 'webapp/components/signup')
-rw-r--r-- | webapp/components/signup/components/signup_email.jsx | 29 | ||||
-rw-r--r-- | webapp/components/signup/components/signup_ldap.jsx | 19 | ||||
-rw-r--r-- | webapp/components/signup/signup_controller.jsx | 14 |
3 files changed, 29 insertions, 33 deletions
diff --git a/webapp/components/signup/components/signup_email.jsx b/webapp/components/signup/components/signup_email.jsx index aa3493c96..9ed10b94c 100644 --- a/webapp/components/signup/components/signup_email.jsx +++ b/webapp/components/signup/components/signup_email.jsx @@ -5,11 +5,10 @@ import LoadingScreen from 'components/loading_screen.jsx'; import * as GlobalActions from 'actions/global_actions.jsx'; import {track} from 'actions/analytics_actions.jsx'; - -import BrowserStore from 'stores/browser_store.jsx'; +import {getInviteInfo} from 'actions/team_actions.jsx'; +import {loginById, createUserWithInvite} from 'actions/user_actions.jsx'; import * as Utils from 'utils/utils.jsx'; -import Client from 'client/web_client.jsx'; import Constants from 'utils/constants.jsx'; import React from 'react'; @@ -58,7 +57,7 @@ export default class SignupEmail extends React.Component { loading = false; } else if (inviteId && inviteId.length > 0) { loading = true; - Client.getInviteInfo( + getInviteInfo( inviteId, (inviteData) => { if (!inviteData) { @@ -118,26 +117,12 @@ export default class SignupEmail extends React.Component { handleSignupSuccess(user, data) { track('signup', 'signup_user_02_complete'); - Client.loginById( + loginById( data.id, user.password, '', - () => { - 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(); - } - } - ); - }, + this.state.hash, + null, (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)); @@ -241,7 +226,7 @@ export default class SignupEmail extends React.Component { allow_marketing: true }; - Client.createUserWithInvite(user, + createUserWithInvite(user, this.state.data, this.state.hash, this.state.inviteId, diff --git a/webapp/components/signup/components/signup_ldap.jsx b/webapp/components/signup/components/signup_ldap.jsx index d80b27159..4c9afc8d6 100644 --- a/webapp/components/signup/components/signup_ldap.jsx +++ b/webapp/components/signup/components/signup_ldap.jsx @@ -5,9 +5,10 @@ import FormError from 'components/form_error.jsx'; import * as GlobalActions from 'actions/global_actions.jsx'; import {track} from 'actions/analytics_actions.jsx'; +import {addUserToTeamFromInvite} from 'actions/team_actions.jsx'; +import {webLoginByLdap} from 'actions/user_actions.jsx'; import * as Utils from 'utils/utils.jsx'; -import Client from 'client/web_client.jsx'; import React from 'react'; import {FormattedMessage, FormattedHTMLMessage} from 'react-intl'; @@ -55,7 +56,7 @@ export default class SignupLdap extends React.Component { this.setState({ldapError: ''}); - Client.webLoginByLdap( + webLoginByLdap( this.state.ldapId, this.state.ldapPassword, null, @@ -69,11 +70,15 @@ export default class SignupLdap extends React.Component { } handleLdapSignupSuccess() { - if (this.props.location.query.id || this.props.location.query.h) { - Client.addUserToTeamFromInvite( - this.props.location.query.d, - this.props.location.query.h, - this.props.location.query.id, + const hash = this.props.location.query.h; + const data = this.props.location.query.d; + const inviteId = this.props.location.query.id; + + if (inviteId || hash) { + addUserToTeamFromInvite( + data, + hash, + inviteId, () => { this.finishSignup(); }, diff --git a/webapp/components/signup/signup_controller.jsx b/webapp/components/signup/signup_controller.jsx index 9bf5936be..737431926 100644 --- a/webapp/components/signup/signup_controller.jsx +++ b/webapp/components/signup/signup_controller.jsx @@ -12,6 +12,7 @@ import BrowserStore from 'stores/browser_store.jsx'; import * as AsyncClient from 'utils/async_client.jsx'; import Client from 'client/web_client.jsx'; import * as GlobalActions from 'actions/global_actions.jsx'; +import {addUserToTeamFromInvite, getInviteInfo} from 'actions/team_actions.jsx'; import logoImage from 'images/logo.png'; import ErrorBar from 'components/error_bar.jsx'; @@ -68,7 +69,7 @@ export default class SignupController extends React.Component { const userLoggedIn = UserStore.getCurrentUser() != null; if ((inviteId || hash) && userLoggedIn) { - Client.addUserToTeamFromInvite( + addUserToTeamFromInvite( data, hash, inviteId, @@ -79,11 +80,16 @@ export default class SignupController extends React.Component { } ); }, - (e) => { + () => { this.setState({ // eslint-disable-line react/no-did-mount-set-state noOpenServerError: true, loading: false, - serverError: e.message + serverError: ( + <FormattedMessage + id='signup_user_completed.invalid_invite' + defaultMessage='The invite link was invalid. Please speak with your Administrator to receive an invitation.' + /> + ) }); } ); @@ -92,7 +98,7 @@ export default class SignupController extends React.Component { } if (inviteId) { - Client.getInviteInfo( + getInviteInfo( inviteId, (inviteData) => { if (!inviteData) { |