Skip to content

Commit

Permalink
fix: 비밀번호 확인 시 에러메세지 표시되지 않는 버그 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
jonique98 committed May 23, 2024
1 parent ed2f0d7 commit 015699d
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
};

Expand Down Expand Up @@ -75,7 +76,7 @@ export const useNewPasswordForm = (props: NewPasswordFormProps) => {
navigate('/myPage');
}
}
navigate('/Login');
setIsNewPasswordCheckError(true);
};

useEffect(() => {
Expand Down

0 comments on commit 015699d

Please sign in to comment.