diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/compass/app/auth/newPassword/page.tsx b/compass/app/auth/newPassword/page.tsx index d230894..1b626ab 100644 --- a/compass/app/auth/newPassword/page.tsx +++ b/compass/app/auth/newPassword/page.tsx @@ -15,25 +15,11 @@ function isStrongPassword(password: string): boolean { export default function Page() { const [newPassword, setNewPassword] = useState(''); const [confirmPassword, setConfirmPassword] = useState(''); - const [valid, setValid] = useState(true); - const [matching, setMatching] = useState(true); const [isButtonDisabled, setIsButtonDisabled] = useState(true); useEffect(() => { - if (newPassword !== ''){ - setValid(isStrongPassword(newPassword)) - } - }, [newPassword]) - - useEffect(() => { - if (confirmPassword !== ''){ - setMatching(newPassword === confirmPassword) - } -}, [newPassword, confirmPassword]) - - useEffect(() => { - setIsButtonDisabled(newPassword === '' || confirmPassword === '' || !matching || !valid); - }, [matching, valid]); + setIsButtonDisabled(newPassword === '' || confirmPassword === '' || newPassword !== confirmPassword|| !isStrongPassword(newPassword)); + }, [newPassword, confirmPassword]); return ( @@ -58,12 +44,13 @@ export default function Page() { type="password" title="Enter New Password" value={newPassword} + valid={isButtonDisabled} onChange={(e) => { setNewPassword(e.target.value); }} /> - {valid ? null :
Tip: Use a mix of letters, numbers, and symbols for a strong password. Aim for at least 8 characters! @@ -79,7 +66,7 @@ export default function Page() { }} />
Please make sure both passwords are the exact same!
diff --git a/compass/components/Input.tsx b/compass/components/Input.tsx
index d5a4348..07c4d16 100644
--- a/compass/components/Input.tsx
+++ b/compass/components/Input.tsx
@@ -5,15 +5,16 @@ type InputProps = InputHTMLAttributes