Add validation for login credentials to determine if real details.
This commit is contained in:
parent
5c0081bdc6
commit
0e168267b1
|
@ -6,16 +6,36 @@ import Button from "react-bootstrap/Button"
|
||||||
import {useState, useEffect} from 'react';
|
import {useState, useEffect} from 'react';
|
||||||
|
|
||||||
export function Signin ( props ) {
|
export function Signin ( props ) {
|
||||||
|
const [email, setEmail] = useState('')
|
||||||
|
const [validemail, setValidemail] = useState(false)
|
||||||
|
const [password, setPassword] = useState('')
|
||||||
|
const [validpassword, setValidpassword] = useState(false)
|
||||||
|
|
||||||
|
useEffect( () => {
|
||||||
|
if(email.indexOf('@') > 0) {
|
||||||
|
setValidemail(true)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setValidemail( false )
|
||||||
|
}
|
||||||
|
}, [email])
|
||||||
|
|
||||||
|
useEffect( () => {
|
||||||
|
if( password.length >= 8 ) {
|
||||||
|
setValidpassword(true)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setValidpassword( false )
|
||||||
|
}
|
||||||
|
}, [password])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
<Row>
|
<Row>
|
||||||
<Col md={ {span: 4, offset: 4} }>
|
<Col md={ {span: 4, offset: 4} }>
|
||||||
|
|
||||||
<Form>
|
<Form>
|
||||||
|
<Form.Group>
|
||||||
<Form.Group>
|
<Form.Label>Email</Form.Label>
|
||||||
|
|
||||||
<Form.Label>Email</Form.Label>
|
|
||||||
|
|
||||||
<Form.Control
|
<Form.Control
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue