summaryrefslogtreecommitdiffstats
path: root/web/react/components/claim/claim_account.jsx
blob: 5b3b584eed896c578153a737d09135aa3632b919 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// 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 {FormattedMessage} from 'mm-intl';

export default class ClaimAccount extends React.Component {
    constructor(props) {
        super(props);

        this.state = {};
    }
    render() {
        let content;
        if (this.props.email === '') {
            content = (
                <p>
                    <FormattedMessage
                        id='claim.account.noEmail'
                        defaultMessage='No email specified'
                    />
                </p>
            );
        } else if (this.props.currentType === '' && this.props.newType !== '') {
            content = (
                <EmailToSSO
                    email={this.props.email}
                    type={this.props.newType}
                    teamName={this.props.teamName}
                    teamDisplayName={this.props.teamDisplayName}
                />
            );
        } else {
            content = (
                <SSOToEmail
                    email={this.props.email}
                    currentType={this.props.currentType}
                    teamName={this.props.teamName}
                    teamDisplayName={this.props.teamDisplayName}
                />
            );
        }

        return content;
    }
}

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
};