최초 커밋

This commit is contained in:
root
2026-07-23 16:15:57 +09:00
commit c8f5efb6b7
14652 changed files with 4812531 additions and 0 deletions
@@ -0,0 +1,404 @@
<!--popup_wrap-->
<div id="pop_search" class="popup_wrap">
<!--popup_in-->
<div class="popup_in">
<button class="btn_close" onclick="$('#view_result').html('');">
<div class="close_div"><img src="<?php echo G5_URL ?>/img/ico_close.svg" alt=""></div>
</button>
<!--popup_content-->
<div class="popup_container search">
<!--pop_join_left-->
<div class="popup_tit">
<h1 class="h_1">비밀번호 <br>재설정</h1>
</div>
<!-- 2025.07 다지인팀 수정 -->
<!-- pop_join_right-->
<div class="popup_contents_wrap" style="display: none;">
<button class="btn_back" onclick="goLogin();">로그인</button>
<div class="tbl_wrap">
<div class="guide_txt"><em>계정 생성에 사용한 아이디</em> 입력해 주세요.<br>입력하신 메일 주소로 인증 링크가 발송됩니다.</div>
<div class="guide_txt"><em>(인증 링크는 3 만료됩니다.)</em></div>
<table>
<tbody>
<tr>
<th class="h_4">아이디</th>
<td>
<div class="id_wrap">
<input id="txt_name" type="text" placeholder="example@eg-bim.co.kr" required>
</div>
<!-- <span class="important_msg h_6">이메일 형식으로 작성</span> -->
<p id="email_feedback" class="important_msg h_6" style="display:none; margin-top:4px;"></p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="join_btn_wrap">
<button type="button" id="btn_id" onclick="ufn_btn_id_click();">아이디 확인</button>
</div>
<div class="inquiry">
계정이 기억나지 않을 경우<br class="brk"> <em>baroncs@baroncs.co.kr</em> 문의하시기 바랍니다.
</div>
</div>
<!--비밀번호 재설정 otp 입력 화면 -->
<!-- <div class="popup_contents_wrap" style="_display: none;">
<button class="btn_back">다른 아이디로 변경하기</button>
<div id="register_form" class="tbl_wrap">
<div class="guide_txt">
사용자 인증을 위해 <em>aaa@gmail.com</em> <br>아이디로 전송된 인증번호를 입력해 주세요.
</div>
<div class="verify_wrap">
<div class="code_input">
<input type="text" maxlength="1" inputmode="numeric" pattern="[0-9]*" />
<input type="text" maxlength="1" inputmode="numeric" pattern="[0-9]*" />
<input type="text" maxlength="1" inputmode="numeric" pattern="[0-9]*" />
<input type="text" maxlength="1" inputmode="numeric" pattern="[0-9]*" />
<input type="text" maxlength="1" inputmode="numeric" pattern="[0-9]*" />
<input type="text" maxlength="1" inputmode="numeric" pattern="[0-9]*" />
</div>
<div>
<span class="important_msg h_6">인증번호 불일치</span>
<button class="btn_send">인증번호 재전송 </button>
</div>
</div>
</div>
<div class="btn_confirm">
<button type="submit" id="btn_submit" class="btn_submit" >인증하기</button>
</div>
<script>
const inputs = document.querySelectorAll('.code-input input');
inputs.forEach((input, index) => {
console.log('dd');
input.addEventListener('input', (e) => {
const value = e.target.value;
if (!/^[0-9]$/.test(value)) {
e.target.value = '';
return;
}
if (value && index < inputs.length - 1) {
inputs[index + 1].focus();
}
});
input.addEventListener('keydown', (e) => {
if (e.key === 'Backspace' && !e.target.value && index > 0) {
inputs[index - 1].focus();
}
});
});
</script>
</div> -->
<div id="password_reset" class="popup_contents_wrap" style="display: none;">
<div class="tbl_wrap">
<!-- <div class="guide_txt">
<em>${email}</em> 계정의 비밀번호를 입력하세요.
</div> -->
<div class="guide_txt">
새로운 비밀번호를 입력하세요.
</div>
<table>
<tbody>
<tr>
<th class="h_4"> 비밀번호</th>
<td>
<input type="password" id="pw_reset1" placeholder="새 비밀번호" autocomplete="new-password">
<!-- 비밀번호 피드백 위치 -->
<p id="pw_reset1_feedback" class="important_msg h_6" style="display:none; margin-top:4px;"></p>
</td>
</tr>
<tr>
<th class="h_4">비밀번호 확인</th>
<td>
<input type="password" id="pw_reset2" placeholder="비밀번호 확인" autocomplete="new-password">
<!-- 비밀번호 확인 피드백 위치 -->
<p id="pw_reset2_feedback" class="important_msg h_6" style="display:none; margin-top:4px;"></p>
</td>
</tr>
</tbody>
</table>
<p id="pw_reset_feedback" class="important_msg h_6" style="display:none;">
비밀번호는 영문자 · 숫자 · 특수문자를 포함한 12 이상이어야 합니다.
</p>
</div>
<div class="join_btn_wrap">
<button type="button" id="btn_pw_reset" onclick="resetPassword();">비밀번호 재설정</button>
</div>
</div>
<!--//pop_join_right-->
<!-- //2025.07 다지인팀 수정 -->
</div>
<!--//popup_content-->
</div>
<!--//popup_in-->
</div>
<script>
// 이메일 유효성 정규식
function isValidEmail(email) {
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
}
$('#txt_name').on('input', function() {
const email = $(this).val().trim();
const fb = $('#email_feedback');
if (!email) {
fb.hide();
$('#btn_id').prop('disabled', true);
return;
}
if (isValidEmail(email)) {
fb.text('올바른 이메일 형식입니다.').css('color', 'green').show();
$('#btn_id').prop('disabled', false);
} else {
fb.text('이메일 형식으로 작성해주세요.').css('color', 'red').show();
$('#btn_id').prop('disabled', true);
}
});
//비밀번호 재설정 인증링크 보내기
$('#txt_name').on('input', function() {
if ($(this).val().trim().length > 0) {
$('#btn_id').prop('disabled', false);
} else {
$('#btn_id').prop('disabled', true);
}
});
function ufn_btn_id_click() {
var email = $('#txt_name').val().trim();
if (!email) {
alert('이메일(아이디)을 입력하세요.');
$('#txt_name').focus();
return;
}
// 비밀번호 재설정 메일 요청
$.ajax({
url: '/egbim/skin/member/basic/descope_send_otp.php', // PHP 처리 파일 경로에 맞게 수정
method: 'POST',
dataType: 'json',
data: { email: email },
success: function(res) {
if (res.status === 'ok') {
alert('인증링크가 이메일로 발송되었습니다.');
// 다음 스텝(OTP 입력창) show/hide 처리
// 예시: $('#pop_reset_otp').show(); // 또는 다음 .popup_contents_wrap show
} else {
alert(res.message || '전송 실패');
}
},
error: function(xhr) {
alert('서버 통신 오류');
}
});
}
//로그인 화면으로 돌아가기
function goLogin() {
// 전체 이동 (페이지로)
// location.href = '/login.php';
// 팝업방식 (예시)
$('#pop_search').hide();
$('#pop_login').show();
}
// //비밀번호 두 값이 모두 있을 경우에만 enabled
// $('#pw_reset1, #pw_reset2').on('input', function() {
// var pw1 = $('#pw_reset1').val();
// var pw2 = $('#pw_reset2').val();
// if (pw1.length > 0 && pw2.length > 0) {
// $('#btn_pw_reset').prop('disabled', false);
// } else {
// $('#btn_pw_reset').prop('disabled', true);
// }
// });
// //비밀번호 재설정 업데이트
// function resetPassword() {
// var pw1 = $('#pw_reset1').val();
// var pw2 = $('#pw_reset2').val();
// if (!pw1 || !pw2) {
// alert('비밀번호를 모두 입력하세요.');
// return;
// }
// if (pw1 !== pw2) {
// alert('비밀번호가 일치하지 않습니다.');
// return;
// }
// // 쿼리스트링 t(토큰) 읽어서 같이 전송
// var resetToken = new URLSearchParams(window.location.search).get('t');
// var email = window.resetEmail || ''; // 상황에 따라 email 세팅
// if (!resetToken) {
// alert('유효하지 않은 접근입니다.');
// return;
// }
// $.ajax({
// url: '/egbim1/skin/member/basic/descope_reset_password.php',
// type: 'POST',
// dataType: 'json',
// data: { email: email, password: pw1, token: resetToken },
// success: function(res) {
// if (res.status === 'ok') {
// alert('비밀번호가 성공적으로 변경되었습니다!\n로그인해주세요.');
// location.href = '/login.php';
// } else {
// alert(res.message || '비밀번호 변경 실패');
// }
// },
// error: function(xhr) {
// alert('통신 오류: ' + xhr.statusText);
// }
// });
// }
let refreshJwt = '';
let resetEmail = '';
$(document).ready(function () {
// 1. URL에서 매직링크 토큰 추출 (t 파라미터)
const resetToken = new URLSearchParams(window.location.search).get('t');
if (!resetToken) return;
// 2. Magic Link 검증: 서버에 토큰을 보내서 refreshJwt, email 받아옴
$.ajax({
url: '/egbim/skin/member/basic/descope_verify_magiclink.php',
type: 'POST',
dataType: 'json',
data: { token: resetToken },
success: function (res) {
if (res.status === 'ok') {
refreshJwt = res.refreshJwt;
resetEmail = res.email;
$('#password_reset').show(); // 비번입력창 보이기
// [추가] 인증 완료 alert를 한 번만 띄움
if (!sessionStorage.getItem('verifiedAlertShown')) {
alert('인증이 완료되었습니다!');
// alert(JSON.stringify(res, null, 2));
sessionStorage.setItem('verifiedAlertShown', '1');
}
} else {
alert(res.message || '링크 인증 실패');
}
},
error: function () {
alert('서버 통신 오류');
}
});
});
// 비밀번호 두 값이 모두 있을 경우에만 enabled
$('#pw_reset1, #pw_reset2').on('input', function () {
var pw1 = $('#pw_reset1').val();
var pw2 = $('#pw_reset2').val();
$('#btn_pw_reset').prop('disabled', pw1.length === 0 || pw2.length === 0);
});
// 비밀번호 재설정
function resetPassword() {
var pw1 = $('#pw_reset1').val();
var pw2 = $('#pw_reset2').val();
if (!pw1 || !pw2) return alert('비밀번호를 모두 입력하세요.');
if (pw1 !== pw2) return alert('비밀번호가 일치하지 않습니다.');
if (!refreshJwt || !resetEmail) return alert('인증 세션이 만료되었습니다. 다시 시도해 주세요.');
$.ajax({
url: '/egbim/skin/member/basic/descope_reset_password.php',
type: 'POST',
dataType: 'json',
data: {
email: resetEmail,
password: pw1,
refreshJwt: refreshJwt
},
success: function (res) {
// alert(res);
if (res.status === 'ok') {
alert('비밀번호가 성공적으로 변경되었습니다!\n로그인해주세요.');
location.href = 'https://eg-bim.com/egbim/index.php';
} else {
alert(res.message + '비밀번호 변경 실패');
}
},
error: function () {
alert('서버 통신 오류');
}
});
}
// (기존 validatePassword 함수가 없다면 추가)
function validatePassword(pw) {
if (pw.length < 12) return { ok: false, reason: '12자 이상이어야 합니다.' };
if (!/[A-Za-z]/.test(pw)) return { ok: false, reason: '영문자가 포함되어야 합니다.' };
if (!/[0-9]/.test(pw)) return { ok: false, reason: '숫자가 포함되어야 합니다.' };
if (!/[!@#$%^&*(),.\[\]{}\\\/~`_+\-=\|;:'"<>\?]/.test(pw))
return { ok: false, reason: '특수문자가 포함되어야 합니다.' };
return { ok: true };
}
// 실시간 피드백
$('#pw_reset1').on('input', function() {
const pw1 = $(this).val().trim();
const fb1 = $('#pw_reset1_feedback');
const check = validatePassword(pw1);
if (!pw1) {
fb1.hide();
} else if (!check.ok) {
fb1.text(check.reason).show();
} else {
fb1.hide();
}
// 버튼 활성화 토글은 아래에서 처리
toggleResetButton();
});
$('#pw_reset2').on('input', function() {
const pw1 = $('#pw_reset1').val().trim();
const pw2 = $(this).val().trim();
const fb2 = $('#pw_reset2_feedback');
if (!pw2) {
fb2.hide();
} else if (pw1 !== pw2) {
fb2.text('비밀번호가 일치하지 않습니다.').show();
} else {
fb2.hide();
}
toggleResetButton();
});
// 버튼 활성화/비활성화 함수
function toggleResetButton() {
const pw1 = $('#pw_reset1').val().trim();
const pw2 = $('#pw_reset2').val().trim();
const check = validatePassword(pw1);
const ok = pw1 && pw2 && check.ok && (pw1 === pw2);
$('#btn_pw_reset').prop('disabled', !ok);
}
</script>