Add validation for login credentials to determine if real details.
This commit is contained in:
parent
5c0081bdc6
commit
0e168267b1
|
@ -6,15 +6,35 @@ import Button from "react-bootstrap/Button"
|
|||
import {useState, useEffect} from 'react';
|
||||
|
||||
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 (
|
||||
<Container>
|
||||
<Row>
|
||||
<Col md={ {span: 4, offset: 4} }>
|
||||
|
||||
<Form>
|
||||
|
||||
<Form.Group>
|
||||
|
||||
<Form.Label>Email</Form.Label>
|
||||
|
||||
<Form.Control
|
||||
|
|
Loading…
Reference in New Issue