Skip to content

Commit

Permalink
fix : code detail fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ha-seungwon committed Aug 17, 2023
1 parent 94149f8 commit b9c037a
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/main/resources/static/html/reset-password.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<div class="frame984">
<div class="text517">이메일 주소</div>
<div class="frame985">
<input type="email" id="email" class="text123" placeholder="Email 입력하기"/>
<input type="text" id="email" class="text123" placeholder="Email 입력하기"/>
</div>
<p class="error-message" id="mergedEmail"></p>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/static/js/personal-information.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 + "점"
}
Expand Down
6 changes: 4 additions & 2 deletions src/main/resources/static/js/record.js
Original file line number Diff line number Diff line change
Expand Up @@ -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; // 조건에 맞지 않으므로 더 이상 검사하지 않고 함수 종료
Expand Down Expand Up @@ -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) + "%"
Expand Down Expand Up @@ -304,6 +303,9 @@ window.addEventListener('DOMContentLoaded', (event) => {
} else {
errorElement.textContent = '';
}
if (inputElement.value !== inputElement.value.trim()) {
errorElement.textContent = '공백은 허용되지 않습니다.';
}
});
});
});
Expand Down
28 changes: 24 additions & 4 deletions src/main/resources/static/js/reset-password-auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,38 @@ 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);
}
});
});

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";
});
}
11 changes: 8 additions & 3 deletions src/main/resources/static/js/reset-password.js
Original file line number Diff line number Diff line change
Expand Up @@ -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("@");
Expand All @@ -28,6 +29,10 @@ function updateMergedEmail() {
if (!regex.test(emailFront)) {
errorMessage = "올바른 이메일 앞 부분을 입력하세요.";
}
else if (!regex.test(emailAfterAt)){
errorMessage = "올바른 이메일 뒷 부분을 입력하세요.";
}

}

if (errorMessage) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/static/js/setting-account.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
18 changes: 14 additions & 4 deletions src/main/resources/static/js/sign-up.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ document.addEventListener("DOMContentLoaded", function () {


if (!emailRegex.test(emailInputValue)) {
alert("올바른 이메일 주소 형식이 아닙니다.");
sAlert("올바른 이메일 주소 형식이 아닙니다.");
} else {
// 이메일 인증 버튼 클릭 시 인증 코드를 메일로 보내는 로직
const userEmail = emailInput.value
Expand Down Expand Up @@ -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("회원가입 정보를 정확하게 입력하세요.")
Expand Down Expand Up @@ -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";
});
}

0 comments on commit b9c037a

Please sign in to comment.