Add validation for login credentials to determine if real details.

This commit is contained in:
Ray 2023-09-19 09:47:10 +00:00 committed by GitHub
parent 5c0081bdc6
commit 0e168267b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 5 deletions

View File

@ -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