1254 lines
57 KiB
PHP
1254 lines
57 KiB
PHP
<?php
|
||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||
include_once __DIR__ . '/asset_urls.php';
|
||
|
||
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
|
||
// add_stylesheet('<link rel="stylesheet" href="'.$member_skin_url.'/style.css">', 0);
|
||
//add_javascript('<script src="'.G5_JS_URL.'/jquery.register_form.js"></script>', 0);
|
||
// if ($config['cf_cert_use'] && ($config['cf_cert_simple'] || $config['cf_cert_ipin'] || $config['cf_cert_hp']))
|
||
// add_javascript('<script src="'.G5_JS_URL.'/certify.js?v='.G5_JS_VER.'"></script>', 0);
|
||
//add_stylesheet('<link rel="stylesheet" href="'.$member_skin_url.'/style.css">', 0);
|
||
|
||
if (!isset($register_action_url)) {
|
||
$register_action_url = '';
|
||
}
|
||
if (!isset($w)) {
|
||
$w = '';
|
||
}
|
||
if (!isset($urlencode)) {
|
||
$urlencode = '';
|
||
}
|
||
if (!isset($agree)) {
|
||
$agree = '';
|
||
}
|
||
if (!isset($agree2)) {
|
||
$agree2 = '';
|
||
}
|
||
if (!isset($required)) {
|
||
$required = '';
|
||
}
|
||
if (!isset($readonly)) {
|
||
$readonly = '';
|
||
}
|
||
if (!isset($name_readonly)) {
|
||
$name_readonly = '';
|
||
}
|
||
if (!isset($hp_required)) {
|
||
$hp_required = '';
|
||
}
|
||
if (!isset($hp_readonly)) {
|
||
$hp_readonly = '';
|
||
}
|
||
if (!isset($mb) || !is_array($mb)) {
|
||
$mb = array();
|
||
}
|
||
|
||
$member = array_merge(array(
|
||
'mb_id' => '',
|
||
'mb_certify' => '',
|
||
'mb_name' => '',
|
||
'mb_hp' => '',
|
||
'mb_comp' => '',
|
||
'mb_comp_team' => '',
|
||
'mb_team' => '',
|
||
), is_array($member) ? $member : array());
|
||
|
||
$mb = array_merge(array(
|
||
'mb_id' => '',
|
||
'mb_name' => '',
|
||
'mb_email' => '',
|
||
), $mb);
|
||
?>
|
||
|
||
<!-- 회원정보 입력/수정 시작 { -->
|
||
<!-- <head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>TOVA Join</title>
|
||
<link rel="stylesheet" href="../css/reset.css" />
|
||
<link rel="stylesheet" href="../css/font.css" />
|
||
<link rel="stylesheet" href="../css/style.css" />
|
||
<script src="../js/jquery-3.6.1.min.js"></script>
|
||
<script src="../js/common.js"></script>
|
||
</head> -->
|
||
<link rel="stylesheet" href="/egbim/css/style.css" />
|
||
|
||
<!-- <body>
|
||
<div class="wrapper"> -->
|
||
<!-- Header -->
|
||
<!-- <header class="header">
|
||
<h1>
|
||
<img src="../img/logo_w.svg" alt="">
|
||
</h1>
|
||
<div class="menu_wrap">
|
||
<div class="menu_my"><img src="../img/ico_my.svg" alt=""></div>
|
||
<div class="menu_ham"><img src="../img/ico_ham.svg" alt=""></div>
|
||
</div>
|
||
</header> -->
|
||
<!-- //Header -->
|
||
|
||
<!--popup_wrap-->
|
||
<div id="pop_join" class="popup_wrap">
|
||
<!--popup_in-->
|
||
<div class="popup_in">
|
||
<button class="btn_close">
|
||
<div class="close_div"><img src="<?php echo egbim_img_url('ico_close.svg'); ?>" alt="sdi"></div>
|
||
</button>
|
||
<!--popup_content-->
|
||
<div class="popup_container register">
|
||
<!--pop_join_left-->
|
||
<div class="popup_tit">
|
||
<h1 class="h_1">회원가입</h1>
|
||
<!-- <ul>
|
||
<li class="join_step">
|
||
<h4 class="h_4">01</h4>
|
||
<h4 class="h_4 txt">약관동의</h4>
|
||
</li>
|
||
<li class="join_step">
|
||
<h4 class="h_4">02</h4>
|
||
<h4 class="h_4 txt">계정 생성</h4>
|
||
</li>
|
||
<li class="join_step">
|
||
<h4 class="h_4">03</h4>
|
||
<h4 class="h_4 txt">사용자 인증</h4>
|
||
</li>
|
||
<li class="join_step">
|
||
<h4 class="h_4">04</h4>
|
||
<h4 class="h_4 txt">추가정보 입력</h4>
|
||
</li>
|
||
</ul> -->
|
||
</div>
|
||
<!-- <div id="addinfo_side_notice" class="addinfo-side-notice" style="display:none;">
|
||
<button class="btn-close-warn" onclick="$('#addinfo_side_notice').hide()">×</button>
|
||
<h3>[추가정보 입력 안내]</h3>
|
||
<p>
|
||
추가정보를 전부 입력하지 않은 상태에서 브라우저 창을 닫거나
|
||
회사정보 기입을 올바르게 하지 않았을 경우<br>
|
||
<strong>EG-BIM 프로그램 사용</strong>과 <strong>Q&A 안내</strong>가 원활하지 않을 수 있습니다.
|
||
</p>
|
||
</div>
|
||
-->
|
||
<!--pop_join_right-->
|
||
<div id="reg_form_join" class="popup_contents_wrap">
|
||
<!-- <form id="fregisterform" name="fregisterform" action="<?php echo $register_action_url?>" onsubmit="return fregisterform_submit(this);" method="post" enctype="multipart/form-data" autocomplete="off"> -->
|
||
<form id="fregisterform" name="fregisterform" action="<?php echo $register_action_url?>" method="post" enctype="multipart/form-data" autocomplete="off">
|
||
<input type="hidden" name="w" value="<?php echo $w ?>">
|
||
<input type="hidden" name="url" value="<?php echo $urlencode ?>">
|
||
<input type="hidden" name="agree" value="<?php echo $agree ?>">
|
||
<input type="hidden" name="agree2" value="<?php echo $agree2 ?>">
|
||
<input type="hidden" name="cert_type" value="<?php echo $member['mb_certify']; ?>">
|
||
<input type="hidden" name="cert_no" value="">
|
||
<!-- <?php //if (isset($member['mb_sex'])) { ?><input type="hidden" name="mb_sex" value="<?php //echo $member['mb_sex'] ?>"><?php //} ?> -->
|
||
<?php //if (isset($member['mb_nick_date']) && $member['mb_nick_date'] > date("Y-m-d", G5_SERVER_TIME - ($config['cf_nick_modify'] * 86400))) { // 닉네임수정일이 지나지 않았다면 ?>
|
||
<!-- <input type="hidden" name="mb_nick_default" value="<?php //echo get_text($member['mb_nick']) ?>">
|
||
<input type="hidden" name="mb_nick" value="<?php //echo get_text($member['mb_nick']) ?>"> -->
|
||
<?php //} ?>
|
||
|
||
<!-- 2025.07 디자인팀 수정 -->
|
||
<!-- 02 계정생성 -->
|
||
<!-- 왼쪽 "02 계정생성"에 on -->
|
||
<fieldset id="join_step_1" style="_display: none;">
|
||
<!--tbl_wrap-->
|
||
<div id="register_form" class="tbl_wrap">
|
||
<div class="guide_txt">
|
||
<p>계정을 생성합니다.</p>
|
||
<em>아이디</em>를 입력해 주세요.
|
||
</div>
|
||
<table>
|
||
<tbody>
|
||
<tr>
|
||
<th class="h_4">아이디</th>
|
||
<td>
|
||
<div class="id_wrap" style="position: relative;">
|
||
<input type="text" class="frm_input full_input" id="reg_mb_id" name="mb_id" onchange="PG_pro('change');" placeholder="아이디 입력" autocomplete="off" maxlength="100" value="<?php echo htmlspecialchars($member['mb_id'], ENT_QUOTES); ?>"<?php echo $required ?> <?php echo $readonly ?> style="padding-right:80px;"/>
|
||
<!-- 중복확인 버튼 항상 보이기 -->
|
||
<button type="button" class="chk_id" onclick="descopeEmailCheck();">
|
||
중복확인
|
||
</button>
|
||
<?php if ($member['mb_id'] === '') : ?>
|
||
<!-- 신규: 아직 확인 안 됨 -->
|
||
<input type="hidden" id="dupl_check_yn" name="dupl_check_yn" value="" placeholder="아이디중복확인여부YN" style="width:250px; background-color:#dfe4ea;" />
|
||
<input type="hidden" id="GB_mb_id" name="GB_mb_id" value="" />
|
||
<?php else : ?>
|
||
<!-- 기존 사용자: 기본적으로 확인된 상태로 처리 -->
|
||
<input type="hidden" name="mb_id" value="<?php echo htmlspecialchars($member['mb_id'], ENT_QUOTES); ?>" />
|
||
<input type="hidden" id="dupl_check_yn" name="dupl_check_yn" value="Y" style="width:250px; background-color:#dfe4ea;" />
|
||
<?php endif; ?>
|
||
</div>
|
||
<span class="important_msg h_6">이메일 형식으로 작성해주세요.</span>
|
||
</td>
|
||
</tr>
|
||
|
||
<!-- <tr>
|
||
<th class="h_4">비밀번호</th>
|
||
<td>
|
||
<div class="password_wrap">
|
||
<input type="password" name="mb_password" id="reg_mb_password" <?php echo $required ?> class="frm_input full_input <?php echo $required ?>" minlength="3" maxlength="20" placeholder="비밀번호 입력">
|
||
<input type="password" name="mb_password_re" id="reg_mb_password_re" <?php echo $required ?> class="frm_input full_input <?php echo $required ?>" minlength="3" maxlength="20" placeholder="비밀번호 확인">
|
||
</div>
|
||
<span class="important_msg h_6">영문+숫자+특수기호 8자 이상</span>
|
||
</td>
|
||
</tr> -->
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<!--//tbl_wrap-->
|
||
<div class="btn_confirm">
|
||
<button type="submit" id="btn_submit" class="btn_submit" >생성하기</button>
|
||
</div>
|
||
</fieldset>
|
||
|
||
<!-- 03 사용자 인증 -->
|
||
<!-- 왼쪽 "03 사용자 인증"에 on -->
|
||
<fieldset id="join_step_2" style="display: none;">
|
||
<!--tbl_wrap-->
|
||
<div id="register_form" class="tbl_wrap">
|
||
<div class="guide_txt">
|
||
<p>인증 후 계정 생성이 완료됩니다.</p>
|
||
사용자 인증을 위해 <em>aaa@gmail.com</em> <br>아이디로 전송된 인증번호를 입력해 주세요.
|
||
</div>
|
||
<div>
|
||
<b>(코드는 5분 후 만료됩니다.)</b>
|
||
</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 id="otp_error_msg" class="important_msg h_6" style="display:none; color: red;">인증번호 불일치</span>
|
||
<button class="btn_send">인증번호 재전송 ⭮</button>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
<!--//tbl_wrap-->
|
||
<div class="btn_confirm">
|
||
<button type="submit" id="btn_submit_otp_sign_up" 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();
|
||
// }
|
||
// });
|
||
// });
|
||
(function() {
|
||
const inputs = document.querySelectorAll('#join_step_2 .code_input input');
|
||
|
||
inputs.forEach((input, index) => {
|
||
input.setAttribute('inputmode', 'numeric');
|
||
input.setAttribute('pattern', '[0-9]*');
|
||
input.maxLength = 1;
|
||
|
||
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') {
|
||
if (e.target.value === '' && index > 0) {
|
||
inputs[index - 1].focus();
|
||
}
|
||
} else if (e.key === 'ArrowLeft' && index > 0) {
|
||
inputs[index - 1].focus();
|
||
} else if (e.key === 'ArrowRight' && index < inputs.length - 1) {
|
||
inputs[index + 1].focus();
|
||
}
|
||
});
|
||
|
||
// 붙여넣기: 전체 코드 한 번에 들어오면 자동 분배
|
||
input.addEventListener('paste', (e) => {
|
||
e.preventDefault();
|
||
const paste = (e.clipboardData || window.clipboardData).getData('text');
|
||
const digits = paste.replace(/\D/g, '').slice(0, inputs.length);
|
||
digits.split('').forEach((ch, i) => {
|
||
inputs[i].value = ch;
|
||
});
|
||
// 마지막 입력한 자리 다음으로 포커스
|
||
const nextIndex = Math.min(digits.length, inputs.length - 1);
|
||
inputs[nextIndex].focus();
|
||
});
|
||
});
|
||
})();
|
||
</script>
|
||
</fieldset>
|
||
|
||
<!-- 04 추가정보 입력 -->
|
||
<!-- 왼쪽 "04 추가정보 입력"에 on -->
|
||
<fieldset id="join_step_3" style="display: none;">
|
||
<!-- <div id="addinfo_warn" class="warn-popup" style="display:none;">
|
||
<div class="warn-content">
|
||
<button class="btn-close-warn" onclick="$('#addinfo_warn').hide()">×</button>
|
||
<h3>[추가정보 입력 안내]</h3>
|
||
<p>
|
||
추가정보를 전부 입력하지 않은 상태에서 브라우저 창을 닫거나<br>
|
||
회사정보 기입을 올바르게 하지 않았을 경우<br>
|
||
<strong>EG-BIM 프로그램 사용</strong>과 <strong>Q&A 안내</strong>가 원활하지 않을 수 있습니다.
|
||
</p>
|
||
<div class="warn-actions">
|
||
<button class="btn-ok" onclick="$('#addinfo_warn').hide()">확인</button>
|
||
</div>
|
||
</div>
|
||
</div> -->
|
||
<!--tbl_wrap-->
|
||
<div id="register_form" class="tbl_wrap" style="gap: 16px">
|
||
<div class="guide_txt" style="font-size: 24px">
|
||
<span id="join_email_display" style="font-size: 18px; font-weight: 700; line-height: 200%"></span><br>
|
||
<em style="color: #fb3c00;">추가 정보를 입력해야</em> <br class="brk"><span class="highlight">회원가입이 완료</span> 됩니다.
|
||
</div>
|
||
<table>
|
||
<tbody>
|
||
<tr>
|
||
<th class="h_4">비밀번호 <span class="required">*<font class="sm">필수</font></span></th>
|
||
<td>
|
||
<div class="password_wrap">
|
||
<input type="password" name="mb_password" id="reg_mb_password" <?php echo $required ?> class="frm_input full_input <?php echo $required ?>" minlength="3" maxlength="20" placeholder="비밀번호 입력" autocomplete="new-password">
|
||
<input type="password" name="mb_password_re" id="reg_mb_password_re" <?php echo $required ?> class="frm_input full_input <?php echo $required ?>" minlength="3" maxlength="20" placeholder="비밀번호 확인" autocomplete="new-password">
|
||
</div>
|
||
<span id="pw_feedback" class="important_msg h_6">영문+숫자+특수기호 12자 이상</span>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th class="h_4">가족사 <span class="required">*<font class="sm">필수</font></span></th>
|
||
<td>
|
||
<div class="radio_wrap">
|
||
<label><input type="radio" class="on" name="family" value="한맥기술" checked>한맥기술</label>
|
||
<label><input type="radio" name="family" value="삼안">삼안</label>
|
||
<label><input type="radio" name="family" value="장헌산업">장헌산업</label>
|
||
<label><input type="radio" name="family" value="PTC">PTC</label>
|
||
<label><input type="radio" name="family" value="바론컨설턴트">바론컨설턴트</label>
|
||
<label><input type="radio" name="family" value="한라산업개발">한라산업개발</label>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<th class="h_4">이름 <span class="required">*<font class="sm">필수</font></span></th>
|
||
<td>
|
||
<div class="name_wrap">
|
||
<input type="text" id="reg_mb_name" name="mb_name" value="<?php echo get_text($member['mb_name']) ?>" <?php echo $required ?> <?php echo $name_readonly; ?> class="frm_input full_input <?php echo $required ?> <?php echo $name_readonly ?>" size="10" placeholder="이름 입력">
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th class="h_4">휴대전화번호 <span class="required">*<font class="sm">필수</font></span></th>
|
||
<td>
|
||
<div class="phone_wrap">
|
||
<input type="text" name="mb_hp" value="<?php echo get_text($member['mb_hp']) ?>" id="reg_mb_hp" <?php echo $hp_required; ?> <?php echo $hp_readonly; ?> class="frm_input full_input <?php echo $hp_required; ?> <?php echo $hp_readonly; ?>" maxlength="20" placeholder="휴대전화번호 입력">
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th class="h_4">직위 및 사번</th>
|
||
<td>
|
||
<div class="company_wrap">
|
||
<input type="text" name="mb_comp" value="<?php echo get_text($member['mb_comp'])?>" id="reg_mb_comp" size="70" maxlength="100" placeholder="직위 입력">
|
||
<input type="text" name="mb_comp_team" value="<?php echo get_text($member['mb_comp_team'])?>" id="reg_mb_comp_team" size="70" maxlength="100" placeholder="회사별 사번 입력">
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th class="h_4">소속부서</th>
|
||
<td>
|
||
<div class="team_wrap">
|
||
<input type="text" id="reg_mb_team" name="mb_team" value="<?php echo get_text($member['mb_team']) ?>" <?php echo $required ?> <?php echo $name_readonly; ?> class="frm_input full_input <?php echo $required ?> <?php echo $name_readonly ?>" size="10" placeholder="소속부서 입력">
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<!--//tbl_wrap-->
|
||
<div class="btn_confirm">
|
||
<button type="button" id="btn_save_info" class="btn_submit" >저장하기</button>
|
||
</div>
|
||
</fieldset>
|
||
<!-- //2025.07 디자인팀 수정 -->
|
||
</form>
|
||
</div>
|
||
<!--//pop_join_right-->
|
||
<!-- 회원가입결과 시작 { register-->
|
||
<div id="pop_result" class="popup_wrap" style="display:none;">
|
||
<p class="reg_result_p">
|
||
<i class="fa fa-gift" aria-hidden="true"></i><br>
|
||
<strong><?php echo get_text($mb['mb_name']); ?></strong>님의 회원가입을 진심으로 축하합니다.
|
||
</p>
|
||
|
||
<?php if (is_use_email_certify()) { ?>
|
||
<p class="result_txt">
|
||
회원 가입 시 입력하신 이메일 주소로 인증메일이 발송되었습니다.<br>
|
||
발송된 인증메일을 확인하신 후 인증처리를 하시면 사이트를 원활하게 이용하실 수 있습니다.
|
||
</p>
|
||
<div id="result_email">
|
||
<span>아이디</span>
|
||
<strong><?php echo $mb['mb_id'] ?></strong><br>
|
||
<span>이메일 주소</span>
|
||
<strong><?php echo $mb['mb_email'] ?></strong>
|
||
</div>
|
||
<p>
|
||
이메일 주소를 잘못 입력하셨다면, 사이트 관리자에게 문의해주시기 바랍니다.
|
||
</p>
|
||
<?php } ?>
|
||
|
||
<p class="result_txt">
|
||
회원님의 비밀번호는 아무도 알 수 없는 암호화 코드로 저장되므로 안심하셔도 좋습니다.<br>
|
||
아이디, 비밀번호 분실시에는 회원가입시 입력하신 이메일 주소를 이용하여 찾을 수 있습니다.
|
||
</p>
|
||
|
||
<p class="result_txt">
|
||
회원 탈퇴는 언제든지 가능하며 일정기간이 지난 후, 회원님의 정보는 삭제하고 있습니다.<br>
|
||
감사합니다.
|
||
</p>
|
||
<!-- } 회원가입결과 끝 -->
|
||
<div class="btn_confirm_reg">
|
||
<a href="<?php echo G5_URL ?>/" class="reg_btn_submit">메인으로</a>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<!--//popup_content-->
|
||
</div>
|
||
<!--//popup_in-->
|
||
</div>
|
||
<!--//popup_wrap-->
|
||
<!-- </div>
|
||
</body> -->
|
||
|
||
<script>
|
||
//*필수 표시 분기
|
||
function toggleRequiredMarks(isInternal) {
|
||
if (isInternal) {
|
||
// 내부 사용자: 필수 마크 숨김
|
||
$('#join_step_3 .required').hide();
|
||
} else {
|
||
// 외부 사용자: 필수 마크 표시
|
||
$('#join_step_3 .required').show();
|
||
}
|
||
}
|
||
|
||
function PG_changeSelect(p_list){
|
||
if(p_list.value == 'type'){
|
||
document.getElementById("register_domain2").style.display = "block";
|
||
}else{
|
||
document.getElementById("register_domain2").style.display = "none";
|
||
}
|
||
}//PG_changeSelect
|
||
|
||
function PG_pro(action) {
|
||
if (action === 'change') {
|
||
$("#dupl_check_yn").val('N');
|
||
$("#GB_mb_id").val('');
|
||
sessionStorage.removeItem("refreshJwt");
|
||
return;
|
||
}
|
||
|
||
if (action === 'dupl_check') {
|
||
descopeEmailCheck();
|
||
}
|
||
}
|
||
|
||
function openOtpStep(email) {
|
||
$('#join_step_1').hide();
|
||
$('#join_step_3').hide();
|
||
$('#join_step_2').show();
|
||
$('#join_step_2 .guide_txt em').text(email);
|
||
$('#join_step_2 .code_input input').val('');
|
||
$('#otp_error_msg').hide();
|
||
|
||
if (typeof AddInfoGuard !== 'undefined' && AddInfoGuard.disable) {
|
||
AddInfoGuard.disable();
|
||
}
|
||
}
|
||
|
||
function descopeEmailCheck() {
|
||
var email = $("#reg_mb_id").val().trim();
|
||
|
||
if (email === "") {
|
||
alert("아이디(이메일)를 입력해 주세요.");
|
||
$("#reg_mb_id").focus();
|
||
return;
|
||
}
|
||
|
||
// 이메일 유효성 검사
|
||
var re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
||
if (!re.test(email)) {
|
||
alert("유효한 이메일 형식으로 입력해 주세요.");
|
||
$("#reg_mb_id").focus();
|
||
return;
|
||
}
|
||
|
||
// 도메인 리스트
|
||
var domain = email.split('@')[1].toLowerCase();
|
||
var internalDomains = [
|
||
'hanmaceng.co.kr',
|
||
'samaneng.com',
|
||
'jangheon.co.kr',
|
||
'hallasanup.com',
|
||
'pre-cast.co.kr',
|
||
'baroncs.co.kr'
|
||
];
|
||
var isInternal = internalDomains.includes(domain);
|
||
|
||
$.ajax({
|
||
url: '/egbim/skin/member/basic/descope_check_email.php',
|
||
type: 'POST',
|
||
data: { email: email },
|
||
dataType: 'json',
|
||
success: function(res) {
|
||
if (res.status === 'ok') {
|
||
// 사용 가능한 이메일일 때
|
||
var msg = "사용 가능한 이메일입니다.\n이 이메일로 가입하시겠습니까?";
|
||
if (isInternal) {
|
||
msg += "\n\n한맥 가족일 경우 인트라넷 메일 계정으로 가입해주세요.\n(개인 메일로 가입시 사내 모든 프로그램을 사용할 수 없습니다.)";
|
||
}
|
||
if (confirm(msg)) {
|
||
$("#dupl_check_yn").val('Y');
|
||
$("#GB_mb_id").val(email);
|
||
$("#reg_mb_password").focus();
|
||
} else {
|
||
$("#reg_mb_id").val('').focus();
|
||
$("#dupl_check_yn").val('N');
|
||
$("#GB_mb_id").val('');
|
||
}
|
||
} else if (res.status === 'incomplete') {
|
||
|
||
alert("이전에 가입이 완료되지 않은 계정입니다.\n인증번호를 다시 발송합니다.");
|
||
|
||
$("#dupl_check_yn").val("Y");
|
||
$("#reg_mb_id").val(res.email);
|
||
$("#GB_mb_id").val(res.email);
|
||
|
||
// 이메일 기준 내부/외부 판별
|
||
var domain = res.email.split('@')[1].toLowerCase();
|
||
var isInternal = internalDomains.includes(domain);
|
||
sessionStorage.setItem("isInternal", isInternal.toString());
|
||
sessionStorage.setItem("loginId", res.email);
|
||
sessionStorage.removeItem("refreshJwt");
|
||
|
||
$.ajax({
|
||
url: '/egbim/skin/member/basic/descope_signup_resend.php',
|
||
type: 'POST',
|
||
data: { email: res.email },
|
||
dataType: 'json',
|
||
success: function(resendRes) {
|
||
if (resendRes.status === 'ok') {
|
||
openOtpStep(res.email);
|
||
} else {
|
||
alert(resendRes.message || '인증번호 재발송에 실패했습니다.');
|
||
}
|
||
},
|
||
error: function(xhr) {
|
||
alert('통신 오류: ' + xhr.statusText);
|
||
}
|
||
});
|
||
|
||
return;
|
||
} else {
|
||
alert('오류가 발생했습니다:\n' + res.message);
|
||
}
|
||
},
|
||
error: function(xhr, status, error) {
|
||
alert(
|
||
'통신 중 오류가 발생했습니다.\n' +
|
||
'상태: ' + status + '\n' +
|
||
'에러: ' + error + '\n' +
|
||
'응답: ' + xhr.responseText
|
||
);
|
||
}
|
||
});
|
||
}
|
||
|
||
|
||
|
||
//추가정보 유효성 체크
|
||
//회원가입 팝업창 우측 join_step class script 처리
|
||
function setJoinStep(stepNumber) {
|
||
const $steps = $('.popup_tit .join_step');
|
||
$steps.removeClass('on');
|
||
$steps.eq(stepNumber - 1).addClass('on');
|
||
|
||
// 필드셋 토글
|
||
$('#join_step_1, #join_step_2, #join_step_3').hide();
|
||
if (stepNumber === 1) {
|
||
$('#join_step_1').show();
|
||
} else if (stepNumber === 2) {
|
||
$('#join_step_1').show(); // 계정 생성은 1번 필드셋 내부
|
||
} else if (stepNumber === 3) {
|
||
$('#join_step_2').show();
|
||
} else if (stepNumber === 4) {
|
||
$('#join_step_3').show();
|
||
}
|
||
}
|
||
|
||
//회원가입 정보입력
|
||
$(document).on('submit', '#fregisterform', function(e) {
|
||
if ($('#join_step_1').is(':visible')) {
|
||
e.preventDefault();
|
||
|
||
var email = $('#reg_mb_id').val().trim();
|
||
|
||
|
||
// 간단 유효성 (더 넣어도 됨)
|
||
if ($("#dupl_check_yn").val() !== 'Y') {
|
||
alert('아이디(이메일) 중복 확인을 해주세요.');
|
||
return false;
|
||
}
|
||
|
||
// Descope 회원가입 + OTP
|
||
$.ajax({
|
||
url: '/egbim/skin/member/basic/descope_signup.php',
|
||
type: 'POST',
|
||
dataType: 'json',
|
||
data: { email: email },
|
||
success: function(res) {
|
||
if (res.status === 'ok') {
|
||
// 단계 전환: 계정생성 → OTP입력
|
||
$('#join_step_1').hide();
|
||
$('#join_step_2').show();
|
||
|
||
// 안내문구에 이메일 표시
|
||
$('#join_step_2 .guide_txt em').text(email);
|
||
$('#join_step_2 input[type="text"]').val('');
|
||
} else {
|
||
alert('가입 실패: ' + (res.message || '서버 오류'));
|
||
}
|
||
},
|
||
error: function(xhr) {
|
||
alert('통신 오류: ' + xhr.statusText);
|
||
}
|
||
});
|
||
return false;
|
||
}
|
||
// 나머지 단계는 아래에서 따로 처리
|
||
});
|
||
|
||
// 인증번호 재전송 버튼 클릭
|
||
$('.btn_send').on('click', function(e) {
|
||
e.preventDefault();
|
||
|
||
var email = $("#reg_mb_id").val().trim();
|
||
if (!email) {
|
||
alert("이메일(아이디)을 먼저 입력해 주세요.");
|
||
$("#reg_mb_id").focus();
|
||
return;
|
||
}
|
||
|
||
// Descope로 OTP 재발송 (예: descope_resend_otp.php로 AJAX 요청)
|
||
$.ajax({
|
||
url: '/egbim/skin/member/basic/descope_signup_resend.php', // 실제 서버 경로로 수정
|
||
type: 'POST',
|
||
data: { email: email },
|
||
dataType: 'json',
|
||
success: function(res) {
|
||
if (res.status === 'ok') {
|
||
alert('인증번호가 이메일로 재전송되었습니다.');
|
||
} else {
|
||
alert('재전송 실패: ' + (res.message || '알 수 없는 오류'));
|
||
}
|
||
},
|
||
error: function(xhr, status, error) {
|
||
alert(
|
||
'통신 오류:\n' +
|
||
'상태: ' + status + '\n' +
|
||
'에러: ' + error + '\n' +
|
||
'응답: ' + xhr.responseText
|
||
);
|
||
}
|
||
});
|
||
});
|
||
|
||
// 이메일 OTP verify
|
||
$('#btn_submit_otp_sign_up').on('click', function(e) {
|
||
e.preventDefault();
|
||
let otp = '';
|
||
$('#join_step_2 .code_input input').each(function() {
|
||
otp += $(this).val();
|
||
});
|
||
otp = otp.trim();
|
||
let email = $('#reg_mb_id').val().trim();
|
||
|
||
if (otp.length !== 6) {
|
||
alert('6자리 인증번호를 모두 입력하세요.');
|
||
return;
|
||
}
|
||
if (!email) {
|
||
alert('이메일이 없습니다. 다시 시도해주세요.');
|
||
return;
|
||
}
|
||
|
||
$.ajax({
|
||
url: '/egbim/skin/member/basic/descope_verify.php',
|
||
type: 'POST',
|
||
dataType: 'json',
|
||
data: { otp_code: otp, email: email },
|
||
success: function(res) {
|
||
if (res.status === 'ok') {
|
||
sessionStorage.setItem("refreshJwt", res.refreshJwt);
|
||
sessionStorage.setItem("loginId", res.loginId);
|
||
sessionStorage.setItem("isInternal", res.isInternal);
|
||
|
||
// OTP 인증 단계 → 추가정보 입력 단계 전환
|
||
$('#join_step_2').hide();
|
||
$('#join_step_3').show();
|
||
AddInfoGuard.enable();
|
||
let displayEmail =
|
||
(res.email && res.email.trim()) ||
|
||
(res.loginId && res.loginId.trim()) ||
|
||
$('#reg_mb_id').val().trim();
|
||
// 🔥 추가정보 입력창 상단에 이메일 표시
|
||
$('#join_email_display').text(displayEmail + " 님");
|
||
// ✅ 안내 문구 표시
|
||
$('#addinfo_side_notice').fadeIn();
|
||
$('#pw_feedback').text('영문+숫자+특수기호 12자 이상').show(); // 고정 안내로 보여줌
|
||
$('#otp_error_msg').hide(); // 이전 OTP 에러 숨김
|
||
|
||
// 내부/외부 분기 처리
|
||
if (res.isInternal) {
|
||
// 내부 사용자: 기존 폼 유지
|
||
$(".radio_wrap").closest("tr").show(); // 가족사
|
||
$(".company_wrap").closest("tr").show(); // 직위 및 사번
|
||
$(".team_wrap").closest("tr").show(); // 소속부서
|
||
$("#external_company_row").remove(); // 외부 회사명 필드 제거 (혹시 있을 경우)
|
||
toggleRequiredMarks(true); // ← *필수 없애기
|
||
} else {
|
||
// 외부 사용자: 특정 필드 숨김
|
||
$(".radio_wrap").closest("tr").hide();
|
||
$(".company_wrap").closest("tr").hide();
|
||
$(".team_wrap").closest("tr").hide();
|
||
toggleRequiredMarks(false); // ← *필수 표시
|
||
|
||
// 회사명 필드가 없다면 새로 추가
|
||
if (!$('#external_company_row').length) {
|
||
const rowHtml = `
|
||
<tr id="external_company_row">
|
||
<th class="h_4">회사명</th>
|
||
<td>
|
||
<div class="company_wrap">
|
||
<input type="text" id="reg_company" name="company" class="frm_input full_input" placeholder="회사명을 입력해주세요">
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
`;
|
||
|
||
$("#join_step_3 table tbody").append(rowHtml);
|
||
}
|
||
// 외부용 소속부서(팀) 입력 필드 추가
|
||
if (!$('#external_team_row').length) {
|
||
const rowHtml = `
|
||
<tr id="external_team_row">
|
||
<th class="h_4">소속부서</th>
|
||
<td>
|
||
<div class="team_wrap">
|
||
<input type="text" id="reg_team" name="team" class="frm_input full_input" placeholder="소속부서을 입력해주세요">
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
`;
|
||
$("#join_step_3 table tbody").append(rowHtml);
|
||
}
|
||
}
|
||
|
||
} else {
|
||
// $('#otp_error_msg').text(res.message || '인증번호 불일치').show();
|
||
$('#otp_error_msg').text('인증번호가 일치하지 않습니다.').show();
|
||
}
|
||
},
|
||
error: function(xhr) {
|
||
$('.important_msg').text('서버 오류: ' + xhr.statusText).show();
|
||
}
|
||
});
|
||
});
|
||
|
||
$('#pw_feedback').hide();
|
||
|
||
// 비밀번호 유효성 검사 함수
|
||
function validatePassword(pw) {
|
||
if (pw.length < 12) return { ok: false, reason: '비밀번호는 [최소 12자리 이상의 영문,숫자,특수문자]를 사용해야 합니다.' };
|
||
if (!/[A-Za-z]/.test(pw)) return { ok: false, reason: '영문자가 최소 1개 포함되어야 합니다.' };
|
||
if (!/[0-9]/.test(pw)) return { ok: false, reason: '숫자가 최소 1개 포함되어야 합니다.' };
|
||
if (!/[!@#$%^&*(),.\[\]{}\\\/~`_+\-=\|;:'"<>\?]/.test(pw)) return { ok: false, reason: '특수문자가 최소 1개 포함되어야 합니다.' };
|
||
return { ok: true };
|
||
}
|
||
|
||
function showPwFeedback(msg) {
|
||
$('#pw_feedback').text(msg).show();
|
||
}
|
||
|
||
function hidePwFeedback() {
|
||
$('#pw_feedback').hide().text('');
|
||
}
|
||
|
||
// 실시간 피드백
|
||
$('#reg_mb_password, #reg_mb_password_re').on('input', function() {
|
||
const pw = $('#reg_mb_password').val().trim();
|
||
const pwRe = $('#reg_mb_password_re').val().trim();
|
||
|
||
const check = validatePassword(pw);
|
||
if (!check.ok) {
|
||
showPwFeedback(check.reason);
|
||
return;
|
||
}
|
||
if (pw && pwRe && pw !== pwRe) {
|
||
showPwFeedback('비밀번호가 일치하지 않습니다.');
|
||
return;
|
||
}
|
||
hidePwFeedback();
|
||
});
|
||
|
||
$('#join_step_3').on('show', function() {
|
||
// (필요하다면 이 이벤트를 트리거하거나, 단계 전환 직후 검증 초기화)
|
||
hidePwFeedback();
|
||
});
|
||
|
||
// $(document).on('click', '#btn_save_info', function(e) {
|
||
// e.preventDefault();
|
||
|
||
// const isInternal = sessionStorage.getItem("isInternal") === "true";
|
||
// const refreshJwt = sessionStorage.getItem("refreshJwt");
|
||
// const loginId = sessionStorage.getItem("loginId");
|
||
|
||
// const password = $('#reg_mb_password').val().trim();
|
||
// const password_re = $('#reg_mb_password_re').val().trim();
|
||
// const name = $('#reg_mb_name').val().trim();
|
||
// const phone = $('#reg_mb_hp').val().trim();
|
||
|
||
// // 비밀번호 유효성
|
||
// const pwCheck = validatePassword(password);
|
||
// if (!pwCheck.ok) {
|
||
// alert(pwCheck.reason);
|
||
// $('#reg_mb_password').focus();
|
||
// return;
|
||
// }
|
||
// if (password !== password_re) {
|
||
// alert('비밀번호와 확인이 일치하지 않습니다.');
|
||
// $('#reg_mb_password_re').focus();
|
||
// return;
|
||
// }
|
||
|
||
// if (!name || !phone) {
|
||
// alert('이름과 휴대전화번호를 입력해주세요.');
|
||
// return;
|
||
// }
|
||
|
||
// if (!loginId || !refreshJwt) {
|
||
// alert('로그인 정보가 누락되었습니다. 다시 인증해주세요.');
|
||
// return;
|
||
// }
|
||
|
||
// // 내부/외부 분기
|
||
// let data = {
|
||
// email: loginId,
|
||
// refreshJwt: refreshJwt,
|
||
// password: password,
|
||
// name: name,
|
||
// phone: phone,
|
||
// completeForm: true
|
||
// };
|
||
|
||
// if (isInternal) {
|
||
// data.familyCompany = $('input[name="family"]:checked').val(); // 서버가 기대하는 이름
|
||
// data.position = $('#reg_mb_comp').val().trim();
|
||
// data.familyUniqueKey = $('#reg_mb_comp_team').val().trim(); // 사번
|
||
// data.team = $('#reg_mb_team').val().trim();
|
||
// } else {
|
||
// data.company = $('#reg_company').val().trim();
|
||
// data.team = $('#reg_team').val().trim();
|
||
// }
|
||
|
||
// $.ajax({
|
||
// url: '/egbim/skin/member/basic/descope_update.php',
|
||
// type: 'POST',
|
||
// data: data,
|
||
// dataType: 'json',
|
||
// success: function(res) {
|
||
// if (res.status === 'ok') {
|
||
// alert('회원가입이 완료되었습니다.');
|
||
// $('#pop_join').hide();
|
||
// $('#pop_result').show();
|
||
// } else {
|
||
// alert(res.message || '저장 실패');
|
||
// }
|
||
// },
|
||
// error: function(xhr) {
|
||
// alert('서버 오류: ' + xhr.statusText + '\n' + xhr.responseText);
|
||
// }
|
||
// });
|
||
// });
|
||
|
||
// 010-1234-5678 자동 포맷
|
||
function autoHyphen010(inputEl) {
|
||
let v = inputEl.value.replace(/\D/g, '').slice(0, 11);
|
||
if (v.length < 4) { inputEl.value = v; return; }
|
||
if (!v.startsWith('010')) { inputEl.value = v; return; }
|
||
if (v.length <= 7) {
|
||
inputEl.value = v.slice(0,3) + '-' + v.slice(3);
|
||
} else {
|
||
inputEl.value = v.slice(0,3) + '-' + v.slice(3,7) + '-' + v.slice(7);
|
||
}
|
||
}
|
||
|
||
function isValidPhone010(str) {
|
||
return /^010-\d{4}-\d{4}$/.test(str.trim());
|
||
}
|
||
|
||
// blur에서 여러 번 경고 뜨는 것 방지 플래그
|
||
let hpWarnedOnce = false;
|
||
|
||
$('#reg_mb_hp')
|
||
.on('input.hp', function () {
|
||
autoHyphen010(this);
|
||
// 사용자가 다시 입력을 시작하면 경고 플래그 해제
|
||
hpWarnedOnce = false;
|
||
})
|
||
.on('paste.hp', function () {
|
||
const el = this;
|
||
setTimeout(function(){ autoHyphen010(el); hpWarnedOnce = false; }, 0);
|
||
})
|
||
.on('blur.hp', function () {
|
||
const v = $(this).val().trim();
|
||
// blur에서는 "한 번만" 경고하고, 재포커스는 setTimeout으로 루프 방지
|
||
if (v && !isValidPhone010(v) && !hpWarnedOnce) {
|
||
hpWarnedOnce = true;
|
||
alert('휴대전화번호는 010-1234-5678 형식으로 입력해 주세요.');
|
||
setTimeout(() => { $('#reg_mb_hp').focus(); }, 0); // 즉시 focus()는 blur 루프 유발
|
||
}
|
||
});
|
||
|
||
|
||
$(document).on('click', '#btn_save_info', function(e) {
|
||
e.preventDefault();
|
||
|
||
// 내부/외부 플래그
|
||
const isInternal = sessionStorage.getItem("isInternal") === "true";
|
||
const loginId = sessionStorage.getItem("loginId");
|
||
const refreshJwt = sessionStorage.getItem("refreshJwt");
|
||
|
||
// 공통 필드
|
||
const password = $('#reg_mb_password').val().trim();
|
||
const password_re = $('#reg_mb_password_re').val().trim();
|
||
const name = $('#reg_mb_name').val().trim();
|
||
const phone = $('#reg_mb_hp').val().trim();
|
||
|
||
// 1) 로그인 정보 확인
|
||
if (!loginId || !refreshJwt) {
|
||
alert('로그인 정보가 누락되었습니다. 다시 인증해주세요.');
|
||
return;
|
||
}
|
||
|
||
// 2) 비밀번호 유효성
|
||
const pwCheck = validatePassword(password);
|
||
if (!pwCheck.ok) {
|
||
alert(pwCheck.reason);
|
||
$('#reg_mb_password').focus();
|
||
return;
|
||
}
|
||
if (password !== password_re) {
|
||
alert('비밀번호와 확인이 일치하지 않습니다.');
|
||
$('#reg_mb_password_re').focus();
|
||
return;
|
||
}
|
||
|
||
// 3) 이름/휴대폰
|
||
if (!name) {
|
||
alert('이름을 입력해주세요.');
|
||
$('#reg_mb_name').focus();
|
||
return;
|
||
}
|
||
if (!phone) {
|
||
alert('휴대전화번호를 입력해주세요.');
|
||
$('#reg_mb_hp').focus();
|
||
return;
|
||
}
|
||
// if (!/^[0-9\-]+$/.test(phone)) {
|
||
// alert('휴대전화번호는 숫자와 하이픈(-)만 허용됩니다.');
|
||
// $('#reg_mb_hp').focus();
|
||
// return;
|
||
// }
|
||
if (!isValidPhone010(phone)) {
|
||
alert('휴대전화번호는 010-1234-5678 형식으로 입력해 주세요.');
|
||
$('#reg_mb_hp').focus();
|
||
return;
|
||
}
|
||
|
||
// 4) 내부/외부 추가 필드
|
||
let data = {
|
||
email: loginId,
|
||
refreshJwt: refreshJwt,
|
||
password: password,
|
||
name: name,
|
||
phone: phone,
|
||
completeForm: true
|
||
};
|
||
|
||
if (isInternal) {
|
||
// 내부: 가족사, 직위, 사번, 소속부서
|
||
const familyCompany = $('input[name="family"]:checked').val() || '';
|
||
const position = $('#reg_mb_comp').val().trim();
|
||
const familyUniqueKey = $('#reg_mb_comp_team').val().trim();
|
||
const team = $('#reg_mb_team').val().trim();
|
||
|
||
if (!familyCompany) {
|
||
alert('가족사를 선택해주세요.');
|
||
$('input[name="family"]').first().focus();
|
||
return;
|
||
}
|
||
if (!position) {
|
||
alert('직위를 입력해주세요.');
|
||
$('#reg_mb_comp').focus();
|
||
return;
|
||
}
|
||
if (!familyUniqueKey) {
|
||
alert('사번을 입력해주세요.');
|
||
$('#reg_mb_comp_team').focus();
|
||
return;
|
||
}
|
||
if (!team) {
|
||
alert('소속부서을 입력해주세요.');
|
||
$('#reg_mb_team').focus();
|
||
return;
|
||
}
|
||
|
||
Object.assign(data, {
|
||
familyCompany,
|
||
position,
|
||
familyUniqueKey,
|
||
team
|
||
});
|
||
|
||
} else {
|
||
// 외부: 회사명, 소속부서
|
||
const company = $('#reg_company').length ? $('#reg_company').val().trim() : '';
|
||
const team = $('#reg_team').length ? $('#reg_team').val().trim() : '';
|
||
|
||
if (!company) {
|
||
alert('회사명을 입력해주세요.');
|
||
$('#reg_company').focus();
|
||
return;
|
||
}
|
||
if (!team) {
|
||
alert('소속부서을 입력해주세요.');
|
||
$('#reg_team').focus();
|
||
return;
|
||
}
|
||
|
||
Object.assign(data, { company, team });
|
||
}
|
||
|
||
// 5) AJAX 전송
|
||
$.ajax({
|
||
url: '/egbim/skin/member/basic/descope_update.php',
|
||
type: 'POST',
|
||
data: data,
|
||
dataType: 'json'
|
||
})
|
||
.done(function(res) {
|
||
if (res.status === 'ok') {
|
||
AddInfoGuard.disable();
|
||
alert('회원가입이 완료되었습니다.');
|
||
$('#pop_join').hide();
|
||
$('#pop_result').show();
|
||
} else {
|
||
alert(res.message || '저장 실패');
|
||
}
|
||
})
|
||
.fail(function(xhr) {
|
||
alert('서버 오류: ' + xhr.statusText + '\n' + xhr.responseText);
|
||
});
|
||
});
|
||
|
||
</script>
|
||
|
||
<script>
|
||
/**
|
||
* 추가정보 입력 가드 (닫기/ESC/새로고침 차단)
|
||
* - join_step_3(추가정보) 화면에서만 활성화
|
||
* - 닫기 버튼/오버레이/ESC 모두 강력 차단 (stopImmediatePropagation)
|
||
*/
|
||
// window.AddInfoGuard = (function () {
|
||
// const POPUP_SEL = '#pop_join';
|
||
// let ON = false;
|
||
|
||
// function beforeUnload(e){
|
||
// if (!ON) return;
|
||
// e.preventDefault();
|
||
// e.returnValue = '';
|
||
// return '';
|
||
// }
|
||
|
||
// // 같은 엘리먼트에 붙은 다른 핸들러까지 즉시 차단
|
||
// function clickBlocker(e){
|
||
// if (!ON) return;
|
||
// // 안내창 닫기 버튼은 그냥 통과
|
||
// if ($(e.target).closest('#addinfo_warn').length) return;
|
||
// e.preventDefault();
|
||
// e.stopPropagation();
|
||
// e.stopImmediatePropagation();
|
||
// alert('추가정보 저장을 완료하신 후 닫을 수 있습니다.');
|
||
// return false;
|
||
// }
|
||
|
||
// function escBlock(e){
|
||
// if (ON && e.key === 'Escape'){
|
||
// e.preventDefault();
|
||
// e.stopPropagation();
|
||
// e.stopImmediatePropagation();
|
||
// return false;
|
||
// }
|
||
// }
|
||
|
||
// function bind(){
|
||
// // 닫기 버튼/오버레이 등 닫힘 트리거로 쓰일 수 있는 것들 전부 막기
|
||
// $(document)
|
||
// .off('click.guard', `${POPUP_SEL} .btn_close, ${POPUP_SEL} [data-close], ${POPUP_SEL} .popup_dim, .popup_wrap .btn_close`)
|
||
// .on('click.guard', `${POPUP_SEL} .btn_close, ${POPUP_SEL} [data-close], ${POPUP_SEL} .popup_dim, .popup_wrap .btn_close`, clickBlocker);
|
||
|
||
// // 혹시 다른 코드가 강제로 display:none 하는 경우 즉시 복원
|
||
// new MutationObserver((muts)=>{
|
||
// if (!ON) return;
|
||
// const $p = $(POPUP_SEL);
|
||
// const hidden = !$p.is(':visible');
|
||
// if (hidden){
|
||
// // 숨겼던 코드를 되돌리고 경고
|
||
// $p.show();
|
||
// alert('추가정보 저장을 완료하신 후 닫을 수 있습니다.');
|
||
// }
|
||
// }).observe(document.querySelector(POPUP_SEL), { attributes:true, attributeFilter:['style','class'] });
|
||
// }
|
||
|
||
// function unbind(){
|
||
// $(document).off('click.guard');
|
||
// }
|
||
|
||
// function enable(){
|
||
// if (ON) return;
|
||
// ON = true;
|
||
// window.addEventListener('beforeunload', beforeUnload, {capture:true});
|
||
// document.addEventListener('keydown', escBlock, true);
|
||
// bind();
|
||
// }
|
||
|
||
// function disable(){
|
||
// if (!ON) return;
|
||
// ON = false;
|
||
// window.removeEventListener('beforeunload', beforeUnload, {capture:true});
|
||
// document.removeEventListener('keydown', escBlock, true);
|
||
// unbind();
|
||
// }
|
||
|
||
// return { enable, disable, isOn: ()=>ON };
|
||
// })();
|
||
|
||
// function closeWarnPopup() {
|
||
// $('#addinfo_warn').hide();
|
||
|
||
// // 안내 팝업 닫을 때는 beforeunload 무조건 해제
|
||
// window.removeEventListener('beforeunload', beforeUnload, {capture:true});
|
||
// }
|
||
window.AddInfoGuard = (function () {
|
||
const POPUP_SEL = '#pop_join';
|
||
let ON = false;
|
||
|
||
function beforeUnload(e){
|
||
if (!ON) return;
|
||
e.preventDefault();
|
||
e.returnValue = '';
|
||
return '';
|
||
}
|
||
|
||
function clickBlocker(e){
|
||
if (!ON) return;
|
||
if ($(e.target).closest('#addinfo_warn').length) return; // 안내창 닫기 버튼 예외
|
||
e.preventDefault();
|
||
e.stopPropagation();
|
||
e.stopImmediatePropagation();
|
||
alert('추가정보 저장을 완료하신 후 닫을 수 있습니다.');
|
||
return false;
|
||
}
|
||
|
||
function escBlock(e){
|
||
if (ON && e.key === 'Escape'){
|
||
e.preventDefault();
|
||
e.stopPropagation();
|
||
e.stopImmediatePropagation();
|
||
return false;
|
||
}
|
||
}
|
||
|
||
function bind(){
|
||
$(document)
|
||
.off('click.guard', `${POPUP_SEL} .btn_close, ${POPUP_SEL} [data-close], ${POPUP_SEL} .popup_dim, .popup_wrap .btn_close`)
|
||
.on('click.guard', `${POPUP_SEL} .btn_close, ${POPUP_SEL} [data-close], ${POPUP_SEL} .popup_dim, .popup_wrap .btn_close`, clickBlocker);
|
||
|
||
new MutationObserver((muts)=>{
|
||
if (!ON) return;
|
||
const $p = $(POPUP_SEL);
|
||
|
||
// 회원가입 팝업 자체가 닫혔을 때만 감지
|
||
if (!$p.is(':visible')){
|
||
$p.show();
|
||
alert('추가정보 저장을 완료하신 후 닫을 수 있습니다.');
|
||
}
|
||
}).observe(document.querySelector(POPUP_SEL), { attributes:true, attributeFilter:['style','class'] });
|
||
|
||
}
|
||
|
||
function unbind(){
|
||
$(document).off('click.guard');
|
||
}
|
||
|
||
function enable(){
|
||
if (ON) return;
|
||
ON = true;
|
||
window.addEventListener('beforeunload', beforeUnload, {capture:true});
|
||
document.addEventListener('keydown', escBlock, true);
|
||
bind();
|
||
}
|
||
|
||
function disable(){
|
||
if (!ON) return;
|
||
ON = false;
|
||
window.removeEventListener('beforeunload', beforeUnload, {capture:true});
|
||
document.removeEventListener('keydown', escBlock, true);
|
||
unbind();
|
||
}
|
||
|
||
return { enable, disable, isOn: ()=>ON, beforeUnload };
|
||
})();
|
||
|
||
// 안내 팝업 닫기
|
||
// function closeWarnPopup() {
|
||
// $('#addinfo_warn').hide();
|
||
// AddInfoGuard.disable(); // 여기서 확실히 해제
|
||
// }
|
||
</script>
|
||
|
||
<!-- } 회원정보 입력/수정 끝 -->
|