// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import ChoosePage from './team_signup_choose_auth.jsx'; import EmailSignUpPage from './team_signup_with_email.jsx'; import SSOSignupPage from './team_signup_with_sso.jsx'; import LdapSignUpPage from './team_signup_with_ldap.jsx'; import Constants from '../utils/constants.jsx'; import {FormattedMessage} from 'mm-intl'; export default class TeamSignUp extends React.Component { constructor(props) { super(props); this.updatePage = this.updatePage.bind(this); var count = 0; if (global.window.mm_config.EnableSignUpWithEmail === 'true') { count = count + 1; } if (global.window.mm_config.EnableSignUpWithGitLab === 'true') { count = count + 1; } if (global.window.mm_config.EnableLdap === 'true') { count = count + 1; } if (count > 1) { this.state = {page: 'choose'}; } else if (global.window.mm_config.EnableSignUpWithEmail === 'true') { this.state = {page: 'email'}; } else if (global.window.mm_config.EnableSignUpWithGitLab === 'true') { this.state = {page: 'gitlab'}; } else if (global.window.mm_config.EnableLdap === 'true') { this.state = {page: 'ldap'}; } else { this.state = {page: 'none'}; } } updatePage(page) { this.setState({page}); } render() { var teamListing = null; if (global.window.mm_config.EnableTeamListing === 'true') { if (this.props.teams.length === 0) { if (global.window.mm_config.EnableTeamCreation !== 'true') { teamListing = (
); } } else { teamListing = (

{ this.props.teams.map((team) => { return (
{team.display_name}
); }) }

); } } if (global.window.mm_config.EnableTeamCreation !== 'true') { if (teamListing == null) { return (
); } return (
{teamListing}
); } if (this.state.page === 'choose') { return (
{teamListing}
); } if (this.state.page === 'email') { return (
{teamListing}
); } else if (this.state.page === 'ldap') { return (
{teamListing}
); } else if (this.state.page === 'gitlab') { return (
{teamListing}
); } else if (this.state.page === 'google') { return (
{teamListing}
); } else if (this.state.page === 'none') { return (
); } return null; } } TeamSignUp.propTypes = { teams: React.PropTypes.array };