SignupView.js
4 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import React from 'react';
import { Link } from 'react-router';
import { Row, Col, FormGroup,
ControlLabel, FormControl,
InputGroup, Button } from 'react-bootstrap';
import handleSignup from './signup';
import { Orgs } from '/imports/collections/orgs/index';
import './signup.css';
export default class Signup extends React.Component {
constructor(props) {
super(props);
this.state = {
orgSlug: ""
};
}
componentWillMount(){
Meteor.subscribe('allOrgsSlug');
}
componentDidMount() {
handleSignup({ component: this });
}
handleChange(e) {
this.setState({ orgSlug: e.target.value });
}
handleSubmit(event) {
event.preventDefault();
}
checkExistingOrgSlug() {
if(this.state.orgSlug==""){return null}
searchOrg = Orgs.find({slug:this.state.orgSlug}).fetch();
if(searchOrg.length>0){
return "error"
}else{
return "success"
}
}
render() {
return (
<div className="Signup">
<Row>
<Col md={ 12 }>
<h4 className="page-header">Sign Up</h4>
<form
ref={ form => (this.signupForm = form) }
onSubmit={ this.handleSubmit }
>
<Row>
<Col xs={ 10 } sm={ 10 }>
<FormGroup controlId="orgSlugField" validationState={this.checkExistingOrgSlug()}>
<ControlLabel>Organisation URL</ControlLabel>
<InputGroup>
<FormControl
type ="text"
ref ="orgSlug"
name ="orgSlug"
placeholder ="Organisation URL"
onChange = {(e) => this.handleChange(e)}
/>
<InputGroup.Addon>@yd.com</InputGroup.Addon>
</InputGroup>
</FormGroup>
</Col>
</Row>
<Row>
<Col xs={ 6 } sm={ 6 }>
<FormGroup>
<ControlLabel>Organisation Name</ControlLabel>
<FormControl
type="text"
ref="orgName"
name="orgName"
placeholder="Organisation Name"
/>
</FormGroup>
</Col>
</Row>
<Row>
<Col xs={ 6 } sm={ 6 }>
<FormGroup>
<ControlLabel>First Name</ControlLabel>
<FormControl
type="text"
ref="firstName"
name="firstName"
placeholder="First Name"
/>
</FormGroup>
</Col>
<Col xs={ 6 } sm={ 6 }>
<FormGroup>
<ControlLabel>Last Name</ControlLabel>
<FormControl
type="text"
ref="lastName"
name="lastName"
placeholder="Last Name"
/>
</FormGroup>
</Col>
</Row>
<FormGroup>
<ControlLabel>Email Address</ControlLabel>
<FormControl
type="text"
ref="emailAddress"
name="emailAddress"
placeholder="Email Address"
/>
</FormGroup>
<FormGroup>
<ControlLabel>Password</ControlLabel>
<FormControl
type="password"
ref="password"
name="password"
placeholder="Password"
/>
</FormGroup>
{/* <Col md={12} */}
<Button type="submit" style={{float: 'right'}} bsStyle="success">Sign Up</Button>
</form>
</Col>
</Row>
</div>
);
}
}