client/src/components/Register.js
changeset 94 2c2a9c8dc216
parent 90 990f2c928b15
child 129 d48946d164c6
--- a/client/src/components/Register.js	Mon Jun 26 17:40:28 2017 +0200
+++ b/client/src/components/Register.js	Mon Jun 26 17:50:24 2017 +0200
@@ -17,6 +17,12 @@
     this.props.authActions.registerSubmit(username, email, password1, password2);
   }
 
+  submit = (e) => {
+    e.preventDefault();
+
+    this.register();
+  }
+
   onClickLogin = (e) => {
     e.preventDefault();
     this.props.history.push('/login');
@@ -45,7 +51,7 @@
           <Row>
             <Col md={6} mdOffset={3}>
               <Panel header={ panelHeader } className="panel-login">
-                <form>
+                <form onSubmit={this.submit}>
                   <FormGroup validationState={ errorMessages && errorMessages.has('username') ? 'error' : null }>
                     <ControlLabel>Username</ControlLabel>
                     <FormControl componentClass="input" type="text" inputRef={ref => { this.username = ref; }} />
@@ -66,7 +72,7 @@
                     <FormControl componentClass="input" type="password" inputRef={ref => { this.password2 = ref; }} />
                     { this.renderErrorMessage(errorMessages, 'password2') }
                   </FormGroup>
-                  <Button block bsStyle="primary" onClick={this.register}>Register</Button>
+                  <Button type="submit" block bsStyle="primary" onClick={this.register}>Register</Button>
                 </form>
               </Panel>
               <p className="text-center">