Adding checks to validate user and password
This commit is contained in:
parent
0861cc7455
commit
76113ace96
|
@ -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>
|
||||||
|
|
Loading…
Reference in New Issue