From ceada27663235bdac9259ba62e596335321da91b Mon Sep 17 00:00:00 2001 From: yoon Date: Mon, 31 Mar 2025 12:21:57 +0900 Subject: [PATCH] =?UTF-8?q?=EC=98=A4=ED=83=80=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?=EB=B0=8F=20=EC=95=84=EC=9D=B4=EB=94=94=20=EA=B8=B8=EC=9D=B4=20?= =?UTF-8?q?=EC=B2=B4=ED=81=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/user/RegisterForm.vue | 29 +++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/components/user/RegisterForm.vue b/src/components/user/RegisterForm.vue index 726df69..3a6b41d 100644 --- a/src/components/user/RegisterForm.vue +++ b/src/components/user/RegisterForm.vue @@ -252,8 +252,15 @@ profile.value = file; }; - // 아이디 중복체크 + // 아이디 체크 const checkIdDuplicate = async () => { + // 길이 검증 먼저 수행 + if (id.value.length < 4) { + idError.value = '아이디는 4자리 이상이어야 합니다.'; + idErrorAlert.value = true; + return; + } + const response = await $api.get(`/user/checkId?memberIds=${id.value}`); if (!response.data.data) { idErrorAlert.value = true; @@ -331,6 +338,16 @@ } }; + watch(id, (newValue) => { + if (newValue && newValue.length >= 4) { + idError.value = ''; + idErrorAlert.value = false; + } else if (newValue && newValue.length < 4) { + idError.value = '아이디는 4자리 이상이어야 합니다.'; + idErrorAlert.value = true; + } + }); + watch(password, (newValue) => { if (newValue && newValue.length >= 4) { passwordErrorAlert.value = false; @@ -355,7 +372,13 @@ addressAlert.value = address.value.trim() === ''; phoneAlert.value = phone.value.trim() === ''; - // 비밀번호 길이 체크 로직 수정 + // 아이디 길이 체크 + if (id.value && id.value.length < 4) { + idErrorAlert.value = true; + idError.value = '아이디는 4자리 이상이어야 합니다.'; + } + + // 비밀번호 길이 체크 if (password.value && password.value.length < 4) { passwordErrorAlert.value = true; passwordError.value = '비밀번호는 4자리 이상이어야 합니다.'; @@ -383,7 +406,7 @@ idAlert.value || idErrorAlert.value || passwordAlert.value || - passwordcErrorAlert.value || + passwordErrorAlert.value || passwordcheckAlert.value || passwordcheckErrorAlert.value || pwhintResAlert.value ||