Adding checks to validate user and password

This commit is contained in:
Ray 2023-09-12 10:50:24 +00:00 committed by GitHub
parent 0861cc7455
commit 76113ace96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 2 deletions

View File

@ -9,8 +9,9 @@ export function Signup ( props ) {
const[username,setUsername] = useState('') const[username,setUsername] = useState('')
const[validusername,setValidusername] = useState(false) const[validusername,setValidusername] = useState(false)
const[useremail,setUseremail] = useState('') const[useremail,setUseremail] = useState('')
const[password,setPassword] = useState('') const[validemail,setValidemail] = useState(false)
const[password,setUserpassword] = useState('')
const[validpassword,setValidpassword] = useState(false)
const submitHandler = (evt) => { const submitHandler = (evt) => {
evt.preventDefault() evt.preventDefault()
} }
@ -24,6 +25,24 @@ export function Signup ( props ) {
} }
}, [username] ) }, [username] )
useEffect( () => {
if(useremail.index0f('@') > 0 ) {
setValidemail(true)
}
else {
setValidemail(false)
}
}, [useremail] )
useEffect( () => {
if( setUserpassword.length >= 8 ) {
setValidpassword(true)
}
else{
setValidpassword(false)
}
}, [setUserpassword] )
return ( return (
<Container> <Container>