From 12896bd23eeba79884245c1c29fdc568cf21a7fa Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Mon, 14 Mar 2016 08:50:46 -0400 Subject: Converting to Webpack. Stage 1. --- web/react/components/claim/claim_account.jsx | 113 ------------------ web/react/components/claim/email_to_sso.jsx | 151 ------------------------ web/react/components/claim/sso_to_email.jsx | 165 --------------------------- 3 files changed, 429 deletions(-) delete mode 100644 web/react/components/claim/claim_account.jsx delete mode 100644 web/react/components/claim/email_to_sso.jsx delete mode 100644 web/react/components/claim/sso_to_email.jsx (limited to 'web/react/components/claim') diff --git a/web/react/components/claim/claim_account.jsx b/web/react/components/claim/claim_account.jsx deleted file mode 100644 index 42fd8dafa..000000000 --- a/web/react/components/claim/claim_account.jsx +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import EmailToSSO from './email_to_sso.jsx'; -import SSOToEmail from './sso_to_email.jsx'; -import TeamStore from '../../stores/team_store.jsx'; - -import {FormattedMessage} from 'mm-intl'; - -export default class ClaimAccount extends React.Component { - constructor(props) { - super(props); - - this.onTeamChange = this.onTeamChange.bind(this); - this.updateStateFromStores = this.updateStateFromStores.bind(this); - - this.state = {}; - } - componentWillMount() { - this.setState({ - email: this.props.location.query.email, - newType: this.props.location.query.new_type, - oldType: this.props.location.query.old_type, - teamName: this.props.params.team, - teamDisplayName: '' - }); - this.updateStateFromStores(); - } - componentDidMount() { - TeamStore.addChangeListener(this.onTeamChange); - } - componentWillUnmount() { - TeamStore.removeChangeListener(this.onTeamChange); - } - updateStateFromStores() { - const team = TeamStore.getByName(this.state.teamName); - let displayName = ''; - if (team) { - displayName = team.displayName; - } - this.setState({ - teamDisplayName: displayName - }); - } - onTeamChange() { - this.updateStateFromStores(); - } - render() { - if (this.state.teamDisplayName === '') { - return (
); - } - let content; - if (this.state.email === '') { - content = ( -

- -

- ); - } else if (this.state.oldType === '' && this.state.newType !== '') { - content = ( - - ); - } else { - content = ( - - ); - } - - return ( -
- -
-
- -
- {content} -
-
-
-
- ); - } -} - -ClaimAccount.defaultProps = { -}; -ClaimAccount.propTypes = { - params: React.PropTypes.object.isRequired, - location: React.PropTypes.object.isRequired -}; diff --git a/web/react/components/claim/email_to_sso.jsx b/web/react/components/claim/email_to_sso.jsx deleted file mode 100644 index c3eea9495..000000000 --- a/web/react/components/claim/email_to_sso.jsx +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import * as Utils from '../../utils/utils.jsx'; -import * as Client from '../../utils/client.jsx'; - -import {intlShape, injectIntl, defineMessages, FormattedMessage} from 'mm-intl'; - -const holders = defineMessages({ - pwdError: { - id: 'claim.email_to_sso.pwdError', - defaultMessage: 'Please enter your password.' - }, - pwd: { - id: 'claim.email_to_sso.pwd', - defaultMessage: 'Password' - } -}); - -class EmailToSSO extends React.Component { - constructor(props) { - super(props); - - this.submit = this.submit.bind(this); - - this.state = {}; - } - submit(e) { - e.preventDefault(); - var state = {}; - - var password = ReactDOM.findDOMNode(this.refs.password).value.trim(); - if (!password) { - state.error = this.props.intl.formatMessage(holders.pwdError); - this.setState(state); - return; - } - - state.error = null; - this.setState(state); - - var postData = {}; - postData.password = password; - postData.email = this.props.email; - postData.team_name = this.props.teamName; - postData.service = this.props.type; - - Client.switchToSSO(postData, - (data) => { - if (data.follow_link) { - window.location.href = data.follow_link; - } - }, - (error) => { - this.setState({error}); - } - ); - } - render() { - var error = null; - if (this.state.error) { - error =
; - } - - var formClass = 'form-group'; - if (error) { - formClass += ' has-error'; - } - - const uiType = Utils.toTitleCase(this.props.type) + ' SSO'; - - return ( -
-

- -

-
-

- -

-

- -

-

- -

-
- -
- {error} - -
-
- ); - } -} - -EmailToSSO.defaultProps = { -}; -EmailToSSO.propTypes = { - intl: intlShape.isRequired, - type: React.PropTypes.string.isRequired, - email: React.PropTypes.string.isRequired, - teamName: React.PropTypes.string.isRequired, - teamDisplayName: React.PropTypes.string.isRequired -}; - -export default injectIntl(EmailToSSO); diff --git a/web/react/components/claim/sso_to_email.jsx b/web/react/components/claim/sso_to_email.jsx deleted file mode 100644 index a16efb57b..000000000 --- a/web/react/components/claim/sso_to_email.jsx +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import * as Utils from '../../utils/utils.jsx'; -import * as Client from '../../utils/client.jsx'; - -import {intlShape, injectIntl, defineMessages, FormattedMessage} from 'mm-intl'; - -const holders = defineMessages({ - enterPwd: { - id: 'claim.sso_to_email.enterPwd', - defaultMessage: 'Please enter a password.' - }, - pwdNotMatch: { - id: 'claim.sso_to_email.pwdNotMatch', - defaultMessage: 'Password do not match.' - }, - newPwd: { - id: 'claim.sso_to_email.newPwd', - defaultMessage: 'New Password' - }, - confirm: { - id: 'claim.sso_to_email.confirm', - defaultMessage: 'Confirm Password' - } -}); - -class SSOToEmail extends React.Component { - constructor(props) { - super(props); - - this.submit = this.submit.bind(this); - - this.state = {}; - } - submit(e) { - const {formatMessage} = this.props.intl; - e.preventDefault(); - const state = {}; - - const password = ReactDOM.findDOMNode(this.refs.password).value.trim(); - if (!password) { - state.error = formatMessage(holders.enterPwd); - this.setState(state); - return; - } - - const confirmPassword = ReactDOM.findDOMNode(this.refs.passwordconfirm).value.trim(); - if (!confirmPassword || password !== confirmPassword) { - state.error = formatMessage(holders.pwdNotMatch); - this.setState(state); - return; - } - - state.error = null; - this.setState(state); - - var postData = {}; - postData.password = password; - postData.email = this.props.email; - postData.team_name = this.props.teamName; - - Client.switchToEmail(postData, - (data) => { - if (data.follow_link) { - window.location.href = data.follow_link; - } - }, - (error) => { - this.setState({error}); - } - ); - } - render() { - const {formatMessage} = this.props.intl; - var error = null; - if (this.state.error) { - error =
; - } - - var formClass = 'form-group'; - if (error) { - formClass += ' has-error'; - } - - const uiType = Utils.toTitleCase(this.props.currentType) + ' SSO'; - - return ( -
-

- -

-
-

- -

-

- -

-
- -
-
- -
- {error} - -
-
- ); - } -} - -SSOToEmail.defaultProps = { -}; -SSOToEmail.propTypes = { - intl: intlShape.isRequired, - currentType: React.PropTypes.string.isRequired, - email: React.PropTypes.string.isRequired, - teamName: React.PropTypes.string.isRequired, - teamDisplayName: React.PropTypes.string -}; - -export default injectIntl(SSOToEmail); -- cgit v1.2.3-1-g7c22