Send login credentials on Enter key
This commit is contained in:
@@ -11,12 +11,13 @@ const Col = ReactBootstrap.Col;
|
|||||||
const Button = ReactBootstrap.Button;
|
const Button = ReactBootstrap.Button;
|
||||||
|
|
||||||
const LoginModal = React.createClass({
|
const LoginModal = React.createClass({
|
||||||
handleLogin: function() {
|
handleSubmit: function(event) {
|
||||||
if (this.props.onLogin) {
|
event.preventDefault();
|
||||||
const username = ReactDOM.findDOMNode(this.refs.username).value;
|
const usernameNode = ReactDOM.findDOMNode(this.refs.username);
|
||||||
const password = ReactDOM.findDOMNode(this.refs.password).value;
|
const passwordNode = ReactDOM.findDOMNode(this.refs.password);
|
||||||
this.props.onLogin(this.props.request, username, password);
|
this.props.onLogin(this.props.request, usernameNode.value, passwordNode.value);
|
||||||
}
|
usernameNode.value = '';
|
||||||
|
passwordNode.value = '';
|
||||||
},
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
return (
|
return (
|
||||||
@@ -43,7 +44,7 @@ const LoginModal = React.createClass({
|
|||||||
<FormGroup>
|
<FormGroup>
|
||||||
<Col sm={ 12 }>
|
<Col sm={ 12 }>
|
||||||
<div className="pull-right">
|
<div className="pull-right">
|
||||||
<Button bsStyle="primary" onClick={ this.handleLogin }>Login</Button>
|
<Button type="submit" bsStyle="primary">Login</Button>
|
||||||
{ ' ' }
|
{ ' ' }
|
||||||
<Button onClick={ this.props.onCancel }>Cancel</Button>
|
<Button onClick={ this.props.onCancel }>Cancel</Button>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user