blob: d896a1f128a02c10579dfce4da623d9ee2a93496 (
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
// 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');
module.exports = React.createClass({
handleSubmit: function(e) {
e.preventDefault();
var state = { };
var email = this.refs.email.getDOMNode().value.trim().toLowerCase();
if (!email || !utils.isEmail(email)) {
state.email_error = "Please enter a valid email address";
this.setState(state);
return;
}
else {
state.email_error = "";
}
client.findTeamsSendEmail(email,
function(data) {
state.sent = true;
this.setState(state);
}.bind(this),
function(err) {
state.email_error = err.message;
this.setState(state);
}.bind(this)
);
},
getInitialState: function() {
return { };
},
render: function() {
var email_error = this.state.email_error ? <label className='control-label'>{ this.state.email_error }</label> : null;
var divStyle = {
"marginTop": "50px",
}
if (this.state.sent) {
return (
<div>
<h4>{"Find Your " + utils.toTitleCase(strings.Team)}</h4>
<p>{"An email was sent with links to any " + strings.TeamPlural + " to which you are a member."}</p>
</div>
);
}
return (
<div>
<h4>Find Your Team</h4>
<form onSubmit={this.handleSubmit}>
<p>{"Get an email with links to any " + strings.TeamPlural + " to which you are a member."}</p>
<div className="form-group">
<label className='control-label'>Email</label>
<div className={ email_error ? "form-group has-error" : "form-group" }>
<input type="text" ref="email" className="form-control" placeholder="you@domain.com" maxLength="128" />
{ email_error }
</div>
</div>
<button className="btn btn-md btn-primary" type="submit">Send</button>
</form>
</div>
);
}
});
|