blob: 13640b1e502fc3f1ebefadf211186fbb9549fe96 (
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
|
// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
// See License.txt for license information.
var ChoosePage = require('./team_signup_choose_auth.jsx');
var EmailSignUpPage = require('./team_signup_with_email.jsx');
var SSOSignupPage = require('./team_signup_with_sso.jsx');
var Constants = require('../utils/constants.jsx');
export default class TeamSignUp extends React.Component {
constructor(props) {
super(props);
this.updatePage = this.updatePage.bind(this);
if (props.services.length === 1) {
if (props.services[0] === Constants.EMAIL_SERVICE) {
this.state = {page: 'email', service: ''};
} else {
this.state = {page: 'service', service: props.services[0]};
}
} else {
this.state = {page: 'choose', service: ''};
}
}
updatePage(page, service) {
this.setState({page: page, service: service});
}
render() {
if (this.state.page === 'email') {
return <EmailSignUpPage />;
} else if (this.state.page === 'service' && this.state.service !== '') {
return <SSOSignupPage service={this.state.service} />;
} else {
return (
<ChoosePage
services={this.props.services}
updatePage={this.updatePage}
/>
);
}
}
}
TeamSignUp.defaultProps = {
services: []
};
TeamSignUp.propTypes = {
services: React.PropTypes.array
};
|