From 015699d9a36310059579ac61cc4b44c6e863467c Mon Sep 17 00:00:00 2001 From: jonique98 Date: Thu, 23 May 2024 20:30:07 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=B9=84=EB=B0=80=EB=B2=88=ED=98=B8=20?= =?UTF-8?q?=ED=99=95=EC=9D=B8=20=EC=8B=9C=20=EC=97=90=EB=9F=AC=EB=A9=94?= =?UTF-8?q?=EC=84=B8=EC=A7=80=20=ED=91=9C=EC=8B=9C=EB=90=98=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EB=8A=94=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NewPasswordForm/useNewPasswordForm.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/home/components/ChangePasswordContents/NewPasswordForm/useNewPasswordForm.ts b/src/home/components/ChangePasswordContents/NewPasswordForm/useNewPasswordForm.ts index c684cd53..451d2e29 100644 --- a/src/home/components/ChangePasswordContents/NewPasswordForm/useNewPasswordForm.ts +++ b/src/home/components/ChangePasswordContents/NewPasswordForm/useNewPasswordForm.ts @@ -32,18 +32,19 @@ export const useNewPasswordForm = (props: NewPasswordFormProps) => { const handleNewPasswordChange = (password: string) => { setNewPassword(password); - if (previousPassword === password) { - setIsNewPasswordError(true); - setErrorMessage('현재 비밀번호와 다른 비밀번호를 입력해주세요.'); - return; - } setErrorMessage(''); + setIsNewPasswordError(false); + if (password.length >= 8) { setIsFirstRender(false); + if (previousPassword === password) { + setIsNewPasswordError(true); + setErrorMessage('현재 비밀번호와 다른 비밀번호를 입력해주세요.'); + return; + } setIsNewPasswordError(!regexp.test(password)); setErrorMessage('숫자와 영문자 조합으로 8자 이상 입력해주세요.'); - } else { - setIsNewPasswordError(true); + return; } }; @@ -75,7 +76,7 @@ export const useNewPasswordForm = (props: NewPasswordFormProps) => { navigate('/myPage'); } } - navigate('/Login'); + setIsNewPasswordCheckError(true); }; useEffect(() => {