From d8bd57901e33a7057e26e782e295099ffcc0da89 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Wed, 6 Sep 2017 23:04:13 -0700 Subject: Removing webapp --- webapp/components/signup/signup_controller.jsx | 375 ------------------------- 1 file changed, 375 deletions(-) delete mode 100644 webapp/components/signup/signup_controller.jsx (limited to 'webapp/components/signup/signup_controller.jsx') diff --git a/webapp/components/signup/signup_controller.jsx b/webapp/components/signup/signup_controller.jsx deleted file mode 100644 index 2fd775428..000000000 --- a/webapp/components/signup/signup_controller.jsx +++ /dev/null @@ -1,375 +0,0 @@ -// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import React from 'react'; -import PropTypes from 'prop-types'; - -import FormError from 'components/form_error.jsx'; -import LoadingScreen from 'components/loading_screen.jsx'; - -import UserStore from 'stores/user_store.jsx'; -import BrowserStore from 'stores/browser_store.jsx'; - -import {Client4} from 'mattermost-redux/client'; -import * as GlobalActions from 'actions/global_actions.jsx'; -import {addUserToTeamFromInvite, getInviteInfo} from 'actions/team_actions.jsx'; -import {loadMe} from 'actions/user_actions.jsx'; - -import logoImage from 'images/logo.png'; -import AnnouncementBar from 'components/announcement_bar'; - -import {FormattedMessage} from 'react-intl'; -import {browserHistory, Link} from 'react-router/es6'; - -export default class SignupController extends React.Component { - constructor(props) { - super(props); - - this.renderSignupControls = this.renderSignupControls.bind(this); - - let loading = false; - let serverError = ''; - let noOpenServerError = false; - let usedBefore = false; - - if (props.location.query) { - const hash = props.location.query.h; - const inviteId = props.location.query.id; - - if (inviteId) { - loading = true; - } else if (hash && !UserStore.getCurrentUser()) { - usedBefore = BrowserStore.getGlobalItem(hash); - } else if (!inviteId && global.window.mm_config.EnableOpenServer !== 'true' && !UserStore.getNoAccounts()) { - noOpenServerError = true; - serverError = ( - - ); - } - } - - this.state = { - loading, - serverError, - noOpenServerError, - usedBefore - }; - } - - componentDidMount() { - BrowserStore.removeGlobalItem('team'); - if (this.props.location.query) { - const hash = this.props.location.query.h; - const data = this.props.location.query.d; - const inviteId = this.props.location.query.id; - - const userLoggedIn = UserStore.getCurrentUser() != null; - - if ((inviteId || hash) && userLoggedIn) { - addUserToTeamFromInvite( - data, - hash, - inviteId, - (team) => { - loadMe().then( - () => { - browserHistory.push('/' + team.name + '/channels/town-square'); - } - ); - }, - this.handleInvalidInvite - ); - - return; - } - - if (inviteId) { - getInviteInfo( - inviteId, - (inviteData) => { - if (!inviteData) { - return; - } - - this.setState({ // eslint-disable-line react/no-did-mount-set-state - serverError: '', - loading: false - }); - }, - this.handleInvalidInvite - ); - - return; - } - - if (userLoggedIn) { - GlobalActions.redirectUserToDefaultTeam(); - } - } - } - - handleInvalidInvite = (err) => { - let serverError; - if (err.server_error_id === 'store.sql_user.save.max_accounts.app_error') { - serverError = err.message; - } else { - serverError = ( - - ); - } - - this.setState({ - noOpenServerError: true, - loading: false, - serverError - }); - } - - renderSignupControls() { - let signupControls = []; - - if (global.window.mm_config.EnableSignUpWithEmail === 'true') { - signupControls.push( - - - - - - - ); - } - - if (global.window.mm_config.EnableSignUpWithGitLab === 'true') { - signupControls.push( - - - - - - - - - ); - } - - if (global.window.mm_license.IsLicensed === 'true' && global.window.mm_config.EnableSignUpWithGoogle === 'true') { - signupControls.push( - - - - - - - - - ); - } - - if (global.window.mm_license.IsLicensed === 'true' && global.window.mm_config.EnableSignUpWithOffice365 === 'true') { - signupControls.push( - - - - - - - - - ); - } - - if (global.window.mm_license.IsLicensed === 'true' && global.window.mm_config.EnableLdap === 'true') { - signupControls.push( - - - - - - - - - ); - } - - if (global.window.mm_license.IsLicensed === 'true' && global.window.mm_config.EnableSaml === 'true') { - let query = ''; - if (window.location.search) { - query = '&action=signup'; - } else { - query = '?action=signup'; - } - - signupControls.push( - - - - - {global.window.mm_config.SamlLoginButtonText} - - - - ); - } - - if (signupControls.length === 0) { - const signupDisabledError = ( - - ); - signupControls = ( - - ); - } else if (signupControls.length === 1) { - 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' + window.location.search); - } - } - - return signupControls; - } - - render() { - if (this.state.loading) { - return (); - } - - if (this.state.usedBefore) { - return ( -
- -
- ); - } - - let serverError = null; - if (this.state.serverError) { - serverError = ( -
- -
- ); - } - - let signupControls; - if (this.state.noOpenServerError || this.state.usedBefore) { - signupControls = null; - } else { - signupControls = this.renderSignupControls(); - } - - return ( -
- -
- - - - -
-
-
- -
-

{global.window.mm_config.SiteName}

-

- -

-
-
- -
-
- {signupControls} - {serverError} -
- - - {' '} - - - - -
-
-
- ); - } -} - -SignupController.propTypes = { - location: PropTypes.object -}; -- cgit v1.2.3-1-g7c22