forked from p15670423/monkey
Small typo in register page, submit on enter fixed in auth pages
This commit is contained in:
parent
7462c1c701
commit
e58cdee246
|
@ -4,10 +4,11 @@ import {Button, Col, Container, Form, Row} from 'react-bootstrap';
|
||||||
import AuthService from '../../services/AuthService';
|
import AuthService from '../../services/AuthService';
|
||||||
import Particles from "react-particles-js";
|
import Particles from "react-particles-js";
|
||||||
import {particleParams} from "../../styles/particle-component/AuthPageParams";
|
import {particleParams} from "../../styles/particle-component/AuthPageParams";
|
||||||
import monkeyDetective from "../../images/militant-monkey.svg";
|
import monkeyGeneral from "../../images/militant-monkey.svg";
|
||||||
|
|
||||||
class LoginPageComponent extends React.Component {
|
class LoginPageComponent extends React.Component {
|
||||||
login = () => {
|
login = (event) => {
|
||||||
|
event.preventDefault()
|
||||||
this.auth.login(this.username, this.password).then(res => {
|
this.auth.login(this.username, this.password).then(res => {
|
||||||
if (res['result']) {
|
if (res['result']) {
|
||||||
this.redirectToHome();
|
this.redirectToHome();
|
||||||
|
@ -66,12 +67,10 @@ class LoginPageComponent extends React.Component {
|
||||||
<Col lg={8} md={8} sm={8}>
|
<Col lg={8} md={8} sm={8}>
|
||||||
<h1 className='auth-title'>Login</h1>
|
<h1 className='auth-title'>Login</h1>
|
||||||
<div>
|
<div>
|
||||||
<Form className={'auth-form'}>
|
<Form className={'auth-form'} onSubmit={this.login}>
|
||||||
<Form.Control onChange={evt => this.updateUsername(evt)} type='text' placeholder='Username'/>
|
<Form.Control onChange={evt => this.updateUsername(evt)} type='text' placeholder='Username'/>
|
||||||
<Form.Control onChange={evt => this.updatePassword(evt)} type='password' placeholder='Password'/>
|
<Form.Control onChange={evt => this.updatePassword(evt)} type='password' placeholder='Password'/>
|
||||||
<Button id={'auth-button'} onClick={() => {
|
<Button id={'auth-button'} type={'submit'}>
|
||||||
this.login()
|
|
||||||
}}>
|
|
||||||
Login
|
Login
|
||||||
</Button>
|
</Button>
|
||||||
{
|
{
|
||||||
|
@ -84,7 +83,7 @@ class LoginPageComponent extends React.Component {
|
||||||
</div>
|
</div>
|
||||||
</Col>
|
</Col>
|
||||||
<Col lg={4} md={4} sm={4}>
|
<Col lg={4} md={4} sm={4}>
|
||||||
<img alt="infection monkey" className={'monkey-detective'} src={monkeyDetective}/>
|
<img alt="infection monkey" className={'monkey-detective'} src={monkeyGeneral}/>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
</Col>
|
</Col>
|
||||||
|
|
|
@ -10,7 +10,8 @@ class RegisterPageComponent extends React.Component {
|
||||||
|
|
||||||
NO_AUTH_API_ENDPOINT = '/api/environment';
|
NO_AUTH_API_ENDPOINT = '/api/environment';
|
||||||
|
|
||||||
register = () => {
|
register = (event) => {
|
||||||
|
event.preventDefault();
|
||||||
this.auth.register(this.username, this.password).then(res => {
|
this.auth.register(this.username, this.password).then(res => {
|
||||||
this.setState({failed: false, error: ''});
|
this.setState({failed: false, error: ''});
|
||||||
if (res['result']) {
|
if (res['result']) {
|
||||||
|
@ -89,13 +90,11 @@ class RegisterPageComponent extends React.Component {
|
||||||
<h1 className='reg-title'>First time?</h1>
|
<h1 className='reg-title'>First time?</h1>
|
||||||
<h3 className='reg-subtitle'>Let's secure your Monkey Island!</h3>
|
<h3 className='reg-subtitle'>Let's secure your Monkey Island!</h3>
|
||||||
<div>
|
<div>
|
||||||
<Form className={'auth-form'}>
|
<Form className={'auth-form'} onSubmit={this.register} >
|
||||||
<Form.Control onChange={evt => this.updateUsername(evt)} type='text' placeholder='Username'/>
|
<Form.Control onChange={evt => this.updateUsername(evt)} type='text' placeholder='Username'/>
|
||||||
<Form.Control onChange={evt => this.updatePassword(evt)} type='password' placeholder='Password'/>
|
<Form.Control onChange={evt => this.updatePassword(evt)} type='password' placeholder='Password'/>
|
||||||
<Button id={'auth-button'} onClick={() => {
|
<Button id={'auth-button'} type={'submit'} >
|
||||||
this.register()
|
Let's go!
|
||||||
}}>
|
|
||||||
Lets go!
|
|
||||||
</Button>
|
</Button>
|
||||||
<Row>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
|
|
Loading…
Reference in New Issue