Created
December 2, 2020 07:52
-
-
Save mayowDev/95270b2a697fa03889a1ae74539fa35d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> Your password must be at least 8 characters long and include at least one number and one of the following symbols !@#$%^&()* | |
const isEmailValid = (mail) => { | |
if (mail) { | |
return /^\S+@\S+\.\S+$/.test(mail) === true | |
} | |
return true | |
} | |
const isPasswordValid = (pass) => { | |
if (pass) { | |
return pass.length > 7 && /^(?=.*\d)(?=.*[a-z])(?=.*[!@#$%^&()*])(?=.*[a-z]).{8,}$/i.test(pass) === true | |
} | |
return true | |
} | |
const checkPassword = (password) => { | |
if (password.length >= 1) { | |
const isValid = isPasswordValid(password) | |
console.log('isValid = ', isValid, password) | |
setPasswordValid(isValid) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment