2016-02-25 12:31:21 -08:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
export default class AuthenticationPage extends React.Component {
|
|
|
|
static propTypes = {
|
|
|
|
onLogin: React.PropTypes.func.isRequired
|
|
|
|
};
|
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
2016-09-13 15:30:58 +02:00
|
|
|
this.state = { email: '' };
|
2016-02-25 12:31:21 -08:00
|
|
|
this.handleLogin = this.handleLogin.bind(this);
|
|
|
|
this.handleEmailChange = this.handleEmailChange.bind(this);
|
|
|
|
}
|
|
|
|
|
2016-02-25 20:40:35 -08:00
|
|
|
handleLogin(e) {
|
|
|
|
e.preventDefault();
|
2016-02-25 12:31:21 -08:00
|
|
|
this.props.onLogin(this.state);
|
|
|
|
}
|
|
|
|
|
|
|
|
handleEmailChange(e) {
|
2016-09-13 15:30:58 +02:00
|
|
|
this.setState({ email: e.target.value });
|
2016-02-25 12:31:21 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2016-02-25 20:40:35 -08:00
|
|
|
return <form onSubmit={this.handleLogin}>
|
2016-02-25 12:31:21 -08:00
|
|
|
<p>
|
|
|
|
<label>Your name or email: <input type='text' onChange={this.handleEmailChange}/></label>
|
|
|
|
</p>
|
|
|
|
<p>
|
2016-02-25 20:40:35 -08:00
|
|
|
<button type='submit'>Login</button>
|
2016-02-25 12:31:21 -08:00
|
|
|
</p>
|
2016-02-25 20:40:35 -08:00
|
|
|
</form>;
|
2016-02-25 12:31:21 -08:00
|
|
|
}
|
|
|
|
}
|