// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. // See License.txt for license information. var client = require('../utils/client.jsx'); module.exports = React.createClass({ displayName: 'TeamSignupAllowedDomainsPage', propTypes: { state: React.PropTypes.object, updateParent: React.PropTypes.func }, submitBack: function(e) { e.preventDefault(); this.props.state.wizard = 'team_url'; this.props.updateParent(this.props.state); }, submitNext: function(e) { e.preventDefault(); if (this.refs.open_network.getDOMNode().checked) { this.props.state.wizard = 'send_invites'; this.props.state.team.type = 'O'; this.props.updateParent(this.props.state); return; } if (this.refs.allow.getDOMNode().checked) { var name = this.refs.name.getDOMNode().value.trim(); var domainRegex = /^\w+\.\w+$/; if (!name) { this.setState({nameError: 'This field is required'}); return; } if (!name.trim().match(domainRegex)) { this.setState({nameError: 'The domain doesn\'t appear valid'}); return; } this.props.state.wizard = 'send_invites'; this.props.state.team.allowed_domains = name; this.props.state.team.type = 'I'; this.props.updateParent(this.props.state); } else { this.props.state.wizard = 'send_invites'; this.props.state.team.type = 'I'; this.props.updateParent(this.props.state); } }, getInitialState: function() { return {}; }, render: function() { client.track('signup', 'signup_team_04_allow_domains'); var nameError = null; var nameDivClass = 'form-group'; if (this.state.nameError) { nameError = ; nameDivClass += ' has-error'; } return (