diff --git a/src/main/resources/static/html/reset-password.html b/src/main/resources/static/html/reset-password.html index 56e5f13..da96801 100644 --- a/src/main/resources/static/html/reset-password.html +++ b/src/main/resources/static/html/reset-password.html @@ -24,7 +24,7 @@
이메일 주소
- +

diff --git a/src/main/resources/static/js/personal-information.js b/src/main/resources/static/js/personal-information.js index eca7103..2f0cd02 100644 --- a/src/main/resources/static/js/personal-information.js +++ b/src/main/resources/static/js/personal-information.js @@ -44,6 +44,7 @@ async function fetchMyInfo() { // } else if (responseMemberInfoValue.applicationTypeName === "교정직공무원(남)" || responseMemberInfoValue.applicationTypeName === "교정직공무원(여)") { // imgElement.src = "../files/type_icon3.png";// 교정직 이미지 경로로 변경 // } + console.log(responseScoreInfoValue.score, responseScoreInfoValue.maxScore) currentScore.innerText = "현재 점수 : " + responseScoreInfoValue.score + "점" maxScore.innerText = "최고 점수 : " + responseScoreInfoValue.maxScore + "점" } diff --git a/src/main/resources/static/js/record.js b/src/main/resources/static/js/record.js index 20d6aa4..513cd89 100644 --- a/src/main/resources/static/js/record.js +++ b/src/main/resources/static/js/record.js @@ -92,9 +92,7 @@ function saveData() { var isValidData = true; data.forEach(function(item) { - console.log("item.score",item.score) if (item.score.length >= 5 || /\s/.test(item.score) || /[^0-9]/.test(item.score)) { - console.log(isValidData) isValidData = false; sAlert("데이터를 정확하게 입력하세요."); return; // 조건에 맞지 않으므로 더 이상 검사하지 않고 함수 종료 @@ -148,6 +146,7 @@ async function fetchMyInfo() { const expectedPassPercent = document.getElementById('expectedPassPercent'); const expectedGrade = document.getElementById('expectedGrade'); + applicationType.innerText = responseMemberInfoValue.applicationTypeName currentScore.innerText = "현재 점수 : " + responseScoreInfoValue.currentScore + "점" expectedPassPercent.innerText = "합격 예상 :" + responseScoreInfoValue.expectedPassPercent.toFixed(2) + "%" @@ -304,6 +303,9 @@ window.addEventListener('DOMContentLoaded', (event) => { } else { errorElement.textContent = ''; } + if (inputElement.value !== inputElement.value.trim()) { + errorElement.textContent = '공백은 허용되지 않습니다.'; + } }); }); }); diff --git a/src/main/resources/static/js/reset-password-auth.js b/src/main/resources/static/js/reset-password-auth.js index a7afa7b..1723425 100644 --- a/src/main/resources/static/js/reset-password-auth.js +++ b/src/main/resources/static/js/reset-password-auth.js @@ -80,14 +80,14 @@ document.addEventListener("DOMContentLoaded", function () { body: JSON.stringify(validAuthApiData), }); if (!response.ok) { - throw new Error("인증에 실패했습니다. 다시 시도해주시기 바랍니다."); + sAlert("인증에 실패했습니다. 다시 시도해주시기 바랍니다."); } authNumberResult.textContent = "인증이 완료되었습니다."; - alert(authNumberResult.textContent); + NoError_sAlert(authNumberResult.textContent); eraseCookie("userEmail"); - window.location.href = "./setting-account.html"; + //window.location.href = "./setting-account.html"; } catch (error) { - alert(error.message); + sAlert(error.message); } }); }); @@ -95,3 +95,23 @@ document.addEventListener("DOMContentLoaded", function () { function eraseCookie(name) { document.cookie = name + '=; Max-Age=0' } +// sAlert('custom alert example!'); +function sAlert(txt, title = 'ERROR',) { + Swal.fire({ + title: title, + text: txt, + confirmButtonText: '닫기' + }); +} + +// sAlert('custom alert example!'); +function NoError_sAlert(txt, title = 'Success') { + Swal.fire({ + title: title, + text: txt, + confirmButtonText: '닫기' + }).then(() => { + // "닫기" 버튼 클릭 시 수행할 동작 + window.location.href = "./setting-account.html"; + }); +} \ No newline at end of file diff --git a/src/main/resources/static/js/reset-password.js b/src/main/resources/static/js/reset-password.js index f8cccdd..4bacfdf 100644 --- a/src/main/resources/static/js/reset-password.js +++ b/src/main/resources/static/js/reset-password.js @@ -10,15 +10,16 @@ emailInput.addEventListener("input", updateMergedEmail); let mail_result = 0 // 정규식 -const regex = /^[a-z0-9]+$/i; // 대소문자 구분 없이 검사하는 정규식 +const regex = /^[a-z0-9.@]+$/i; // 대소문자 구분 없이 검사하는 정규식 function updateMergedEmail() { - const email = emailInput.value; + let email = emailInput.value; let errorMessage = ''; + if (!email) { errorMessage = "이메일을 입력하세요."; - } else if (!email.includes("@")) { + } else if (email !== email.replaceAll(' ','')) { // 공백이 포함되거나 마지막 문자가 공백인 경우 errorMessage = "올바른 이메일 주소를 입력하세요."; } else { const parts = email.split("@"); @@ -28,6 +29,10 @@ function updateMergedEmail() { if (!regex.test(emailFront)) { errorMessage = "올바른 이메일 앞 부분을 입력하세요."; } + else if (!regex.test(emailAfterAt)){ + errorMessage = "올바른 이메일 뒷 부분을 입력하세요."; + } + } if (errorMessage) { diff --git a/src/main/resources/static/js/setting-account.js b/src/main/resources/static/js/setting-account.js index b023df1..74f620f 100644 --- a/src/main/resources/static/js/setting-account.js +++ b/src/main/resources/static/js/setting-account.js @@ -180,7 +180,7 @@ document.addEventListener("DOMContentLoaded", function () { const input_imageData = getImageData(uploadedImage); - if (!(dropdown_activate_flag==1) && !(password_activate_flag==1){//드랍다운 변경 안함,비번 병경 안함 + if (!(dropdown_activate_flag==1) && !(password_activate_flag==1)){//드랍다운 변경 안함,비번 병경 안함 // 회원가입 - 서버에 요청 const userData = { password: restPassword, diff --git a/src/main/resources/static/js/sign-up.js b/src/main/resources/static/js/sign-up.js index 5880205..4311dd2 100644 --- a/src/main/resources/static/js/sign-up.js +++ b/src/main/resources/static/js/sign-up.js @@ -111,7 +111,7 @@ document.addEventListener("DOMContentLoaded", function () { if (!emailRegex.test(emailInputValue)) { - alert("올바른 이메일 주소 형식이 아닙니다."); + sAlert("올바른 이메일 주소 형식이 아닙니다."); } else { // 이메일 인증 버튼 클릭 시 인증 코드를 메일로 보내는 로직 const userEmail = emailInput.value @@ -283,11 +283,11 @@ document.addEventListener("DOMContentLoaded", function () { window.location.href = "../html/error-500.html"; throw new Error('token remove fail'); } + NoeError_sAlert("회원가입을 성공했습니다."); + - window.location.href = "../html/dashboard.html"; - alert("회원가입을 성공했습니다."); } catch (error) { - alert(error.message); + sAlert(error.message); } } else { sAlert("회원가입 정보를 정확하게 입력하세요.") @@ -369,3 +369,13 @@ function sAlert(txt, title = 'ERROR',) { confirmButtonText: '닫기' }); } +// sAlert('custom alert example!'); +function NoeError_sAlert(txt, title = 'Success',) { + Swal.fire({ + title: title, + text: txt, + confirmButtonText: '닫기' + }).then((result) => { + window.location.href = "../html/dashboard.html"; + }); +}