summaryrefslogtreecommitdiffstats
path: root/web/react/components/claim/claim_account.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'web/react/components/claim/claim_account.jsx')
-rw-r--r--web/react/components/claim/claim_account.jsx87
1 files changed, 71 insertions, 16 deletions
diff --git a/web/react/components/claim/claim_account.jsx b/web/react/components/claim/claim_account.jsx
index 5b3b584ee..42fd8dafa 100644
--- a/web/react/components/claim/claim_account.jsx
+++ b/web/react/components/claim/claim_account.jsx
@@ -3,6 +3,7 @@
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';
@@ -10,11 +11,46 @@ 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 (<div/>);
+ }
let content;
- if (this.props.email === '') {
+ if (this.state.email === '') {
content = (
<p>
<FormattedMessage
@@ -23,36 +59,55 @@ export default class ClaimAccount extends React.Component {
/>
</p>
);
- } else if (this.props.currentType === '' && this.props.newType !== '') {
+ } else if (this.state.oldType === '' && this.state.newType !== '') {
content = (
<EmailToSSO
- email={this.props.email}
- type={this.props.newType}
- teamName={this.props.teamName}
- teamDisplayName={this.props.teamDisplayName}
+ email={this.state.email}
+ type={this.state.newType}
+ teamName={this.state.teamName}
+ teamDisplayName={this.state.teamDisplayName}
/>
);
} else {
content = (
<SSOToEmail
- email={this.props.email}
- currentType={this.props.currentType}
- teamName={this.props.teamName}
- teamDisplayName={this.props.teamDisplayName}
+ email={this.state.email}
+ currentType={this.state.oldType}
+ teamName={this.state.teamName}
+ teamDisplayName={this.state.teamDisplayName}
/>
);
}
- return content;
+ return (
+ <div>
+ <div className='signup-header'>
+ <a href='/'>
+ <span className='fa fa-chevron-left'/>
+ <FormattedMessage
+ id='web.header.back'
+ />
+ </a>
+ </div>
+ <div className='col-sm-12'>
+ <div className='signup-team__container'>
+ <img
+ className='signup-team-logo'
+ src='/static/images/logo.png'
+ />
+ <div id='claim'>
+ {content}
+ </div>
+ </div>
+ </div>
+ </div>
+ );
}
}
ClaimAccount.defaultProps = {
};
ClaimAccount.propTypes = {
- currentType: React.PropTypes.string.isRequired,
- newType: React.PropTypes.string.isRequired,
- email: React.PropTypes.string.isRequired,
- teamName: React.PropTypes.string.isRequired,
- teamDisplayName: React.PropTypes.string.isRequired
+ params: React.PropTypes.object.isRequired,
+ location: React.PropTypes.object.isRequired
};