mirror of
https://github.com/cssgunc/compass.git
synced 2025-04-10 06:10:17 -04:00
added validation for strong passwords.
This commit is contained in:
parent
c510c59057
commit
6dcb0eb5cc
|
@ -15,15 +15,21 @@ function isStrongPassword(password: string): boolean {
|
||||||
export default function Page() {
|
export default function Page() {
|
||||||
const [newPassword, setNewPassword] = useState('');
|
const [newPassword, setNewPassword] = useState('');
|
||||||
const [confirmPassword, setConfirmPassword] = useState('');
|
const [confirmPassword, setConfirmPassword] = useState('');
|
||||||
|
const [valid, setValid] = useState(false);
|
||||||
|
const [matching, setMatching] = useState(false);
|
||||||
const [isButtonDisabled, setIsButtonDisabled] = useState(true);
|
const [isButtonDisabled, setIsButtonDisabled] = useState(true);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setValid(isStrongPassword(newPassword))
|
||||||
|
setMatching(newPassword === confirmPassword)
|
||||||
|
}, [newPassword, confirmPassword])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log('newPassword',newPassword)
|
setIsButtonDisabled(newPassword === '' || confirmPassword === '' || !matching || !valid);
|
||||||
console.log('confirmPassword',confirmPassword)
|
console.log(matching)
|
||||||
setIsButtonDisabled(newPassword === '' || confirmPassword === '' || newPassword !== confirmPassword);
|
console.log(valid)
|
||||||
console.log('newPasswordDisabledTest',isButtonDisabled)
|
console.log('newPasswordDisabledTest',isButtonDisabled)
|
||||||
}, [newPassword, confirmPassword]);
|
}, [matching, valid]);
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user