feat: 비밀번호 유효성 검사 추가

- 비밀번호 길이, 대문자, 소문자, 숫자 포함 여부 체크 기능 구현
- 두 비밀번호 일치 여부 확인 로직 강화
This commit is contained in:
nalpari 2025-06-20 10:16:02 +09:00
parent 6adbbc7eb3
commit dc53a2588a

View File

@ -21,10 +21,36 @@ export default function PwResetForm() {
const [value, setValue, removeValue] = useLocalStorage<{ indivisualData: string }>('hanasysIndivisualState', { indivisualData: '' })
const validatePwd = () => {
// 비밀번호 길이 체크 (8글자 이상)
if (pwd01.length < 8) {
alert('비밀번호는 8글자 이상이어야 합니다.')
return false
}
// 영문 대문자 포함 체크
if (!/[A-Z]/.test(pwd01)) {
alert('비밀번호에 영문 대문자를 포함해야 합니다.')
return false
}
// 영문 소문자 포함 체크
if (!/[a-z]/.test(pwd01)) {
alert('비밀번호에 영문 소문자를 포함해야 합니다.')
return false
}
// 숫자 포함 체크
if (!/[0-9]/.test(pwd01)) {
alert('비밀번호에 숫자를 포함해야 합니다.')
return false
}
// 두 비밀번호 일치 체크
if (pwd01 !== pwd02) {
alert('비밀번호가 일치하지 않습니다.')
return false
}
return true
}