Small typo in register page, submit on enter fixed in auth pages

This commit is contained in:
VakarisZ 2020-06-25 10:26:59 +03:00
parent 7462c1c701
commit e58cdee246
2 changed files with 11 additions and 13 deletions

View File

@ -4,10 +4,11 @@ import {Button, Col, Container, Form, Row} from 'react-bootstrap';
import AuthService from '../../services/AuthService';
import Particles from "react-particles-js";
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 {
login = () => {
login = (event) => {
event.preventDefault()
this.auth.login(this.username, this.password).then(res => {
if (res['result']) {
this.redirectToHome();
@ -66,12 +67,10 @@ class LoginPageComponent extends React.Component {
<Col lg={8} md={8} sm={8}>
<h1 className='auth-title'>Login</h1>
<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.updatePassword(evt)} type='password' placeholder='Password'/>
<Button id={'auth-button'} onClick={() => {
this.login()
}}>
<Button id={'auth-button'} type={'submit'}>
Login
</Button>
{
@ -84,7 +83,7 @@ class LoginPageComponent extends React.Component {
</div>
</Col>
<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>
</Row>
</Col>

View File

@ -10,7 +10,8 @@ class RegisterPageComponent extends React.Component {
NO_AUTH_API_ENDPOINT = '/api/environment';
register = () => {
register = (event) => {
event.preventDefault();
this.auth.register(this.username, this.password).then(res => {
this.setState({failed: false, error: ''});
if (res['result']) {
@ -89,13 +90,11 @@ class RegisterPageComponent extends React.Component {
<h1 className='reg-title'>First time?</h1>
<h3 className='reg-subtitle'>Let's secure your Monkey Island!</h3>
<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.updatePassword(evt)} type='password' placeholder='Password'/>
<Button id={'auth-button'} onClick={() => {
this.register()
}}>
Lets go!
<Button id={'auth-button'} type={'submit'} >
Let's go!
</Button>
<Row>
<Col>