summaryrefslogtreecommitdiffstats
path: root/web/react/components/team_signup_with_email.jsx
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2015-08-28 09:14:37 -0400
committerChristopher Speller <crspeller@gmail.com>2015-08-28 09:14:37 -0400
commit75af5d4536cc414d171c2fe6dca78e455eb18b37 (patch)
tree4e00cf97b5f4f570b1901093bfa4e208749932a0 /web/react/components/team_signup_with_email.jsx
parentd107b392a6309a41eac6cd7d07d720a21968eb56 (diff)
parentf5fec3a157e6c9146a0c4e28dd5f70e6c066affd (diff)
downloadchat-75af5d4536cc414d171c2fe6dca78e455eb18b37.tar.gz
chat-75af5d4536cc414d171c2fe6dca78e455eb18b37.tar.bz2
chat-75af5d4536cc414d171c2fe6dca78e455eb18b37.zip
Merge pull request #496 from mattermost/mm-2015
MM-2015 Added the ability to create a team with SSO services and added the ability to turn off email sign up.
Diffstat (limited to 'web/react/components/team_signup_with_email.jsx')
-rw-r--r--web/react/components/team_signup_with_email.jsx82
1 files changed, 82 insertions, 0 deletions
diff --git a/web/react/components/team_signup_with_email.jsx b/web/react/components/team_signup_with_email.jsx
new file mode 100644
index 000000000..c7204880f
--- /dev/null
+++ b/web/react/components/team_signup_with_email.jsx
@@ -0,0 +1,82 @@
+// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+var utils = require('../utils/utils.jsx');
+var client = require('../utils/client.jsx');
+
+export default class EmailSignUpPage extends React.Component {
+ constructor() {
+ super();
+
+ this.handleSubmit = this.handleSubmit.bind(this);
+
+ this.state = {};
+ }
+ handleSubmit(e) {
+ e.preventDefault();
+ var team = {};
+ var state = {serverError: ''};
+
+ team.email = this.refs.email.getDOMNode().value.trim().toLowerCase();
+ if (!team.email || !utils.isEmail(team.email)) {
+ state.emailError = 'Please enter a valid email address';
+ state.inValid = true;
+ } else {
+ state.emailError = '';
+ }
+
+ if (state.inValid) {
+ this.setState(state);
+ return;
+ }
+
+ client.signupTeam(team.email,
+ function success(data) {
+ if (data.follow_link) {
+ window.location.href = data.follow_link;
+ } else {
+ window.location.href = '/signup_team_confirm/?email=' + encodeURIComponent(team.email);
+ }
+ },
+ function fail(err) {
+ state.serverError = err.message;
+ this.setState(state);
+ }.bind(this)
+ );
+ }
+ render() {
+ return (
+ <form
+ role='form'
+ onSubmit={this.handleSubmit}
+ >
+ <div className='form-group'>
+ <input
+ autoFocus={true}
+ type='email'
+ ref='email'
+ className='form-control'
+ placeholder='Email Address'
+ maxLength='128'
+ />
+ </div>
+ <div className='form-group'>
+ <button
+ className='btn btn-md btn-primary'
+ type='submit'
+ >
+ Sign up
+ </button>
+ </div>
+ <div className='form-group margin--extra-2x'>
+ <span><a href='/find_team'>{'Find my ' + strings.Team}</a></span>
+ </div>
+ </form>
+ );
+ }
+}
+
+EmailSignUpPage.defaultProps = {
+};
+EmailSignUpPage.propTypes = {
+};