This repository was archived by the owner on Feb 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathsignup.js
86 lines (81 loc) · 2.3 KB
/
signup.js
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
import React from 'react';
import { connect } from 'react-redux';
import actions from '../redux/actions';
import initialize from '../utils/initialize';
import Layout from '../components/Layout';
class Signup extends React.Component {
constructor(props) {
super(props);
this.state = {
email: '',
password: ''
};
}
static getInitialProps(ctx) {
initialize(ctx);
}
handleSubmit(e) {
e.preventDefault();
this.props.authenticate(
{ email: this.state.email, password: this.state.password },
'signup'
);
}
render() {
return (
<Layout title="Sign Up">
<h3 className="title is-3">Sign Up</h3>
<form
onSubmit={this.handleSubmit.bind(this)}
className="container"
style={{ width: '540px' }}
>
<div className="field">
<p className="control has-icons-left has-icons-right">
<input
className="input"
type="email"
placeholder="Email"
required
value={this.state.email}
onChange={e => this.setState({ email: e.target.value })}
/>
<span className="icon is-small is-left">
<i className="fas fa-envelope" />
</span>
<span className="icon is-small is-right">
<i className="fas fa-check" />
</span>
</p>
</div>
<div className="field">
<p className="control has-icons-left">
<input
className="input"
type="password"
placeholder="Password"
required
value={this.state.password}
onChange={e => this.setState({ password: e.target.value })}
/>
<span className="icon is-small is-left">
<i className="fas fa-lock" />
</span>
</p>
</div>
<div className="field">
<p className="control has-text-centered">
<button type="submit" className="button is-success">
Sign In
</button>
</p>
</div>
</form>
</Layout>
);
}
}
export default connect(
state => state,
actions
)(Signup);