아이디/비밀번호 찾기 수정(3)

This commit is contained in:
김현욱
2025-12-24 11:49:29 +09:00
parent c99e76fc12
commit e018aa5f76
2 changed files with 323 additions and 33 deletions

View File

@@ -126,7 +126,7 @@
return; return;
}else if(!$('#srchIdEmail').val()){ }else if(!$('#srchIdEmail').val()){
alert('이메일 주소를 입력해 주세요.'); alert('이메일 주소를 입력해 주세요.');
$('#srchIdPhoneNb').focus(); $('#srchIdEmail').focus();
return; return;
} }
@@ -238,7 +238,6 @@
let mbrEmail; let mbrEmail;
let mbrNm; let mbrNm;
let mbtlnb;
if (findType === 'id') { if (findType === 'id') {
mbrEmail = $('#srchIdEmail').val(); mbrEmail = $('#srchIdEmail').val();
mbrNm = $('#srchIdMbrNm').val(); mbrNm = $('#srchIdMbrNm').val();

View File

@@ -27,26 +27,30 @@
$(document).ready(function() { $(document).ready(function() {
fn_set_header_title("아이디/비밀번호 찾기"); fn_set_header_title("아이디/비밀번호 찾기");
fn_select_tap('id'); fn_select_tap('id');
fn_show_phoneAuth(); fn_show_emailAuth();
// fn_show_phoneAuth();
first = 0; first = 0;
$(".login__inputBox__alertText").hide(); $(".login__inputBox__alertText").hide();
fn_alert_hide($("#srchIdMbrNm"), $("#srchIdMbrNmAlert")); fn_alert_hide($("#srchIdMbrNm"), $("#srchIdMbrNmAlert"));
fn_alert_hide($("#srchIdPhoneNb"), $("#srchIdPhoneNbAlert")); // fn_alert_hide($("#srchIdPhoneNb"), $("#srchIdPhoneNbAlert"));
fn_alert_hide($("#srchIdEmail"), $("#srchIdEmailAlert"));
fn_alert_hide($("#srchIdSendungNb"), $("#srchIdSendungNbAlert")); fn_alert_hide($("#srchIdSendungNb"), $("#srchIdSendungNbAlert"));
fn_alert_hide($("#srchPsMbrNm"), $("#srchPsMbrNmAlert")); fn_alert_hide($("#srchPsMbrNm"), $("#srchPsMbrNmAlert"));
fn_alert_hide($("#srchPsMbrId"), $("#srchPsMbrIdAlert")); fn_alert_hide($("#srchPsMbrId"), $("#srchPsMbrIdAlert"));
fn_alert_hide($("#srchPsPhoneNb"), $("#srchPsPhoneNbAlert")); // fn_alert_hide($("#srchPsPhoneNb"), $("#srchPsPhoneNbAlert"));
fn_alert_hide($("#srchPsEmail"), $("#srchPsEmailAlert"));
fn_alert_hide($("#srchPsSendungNb"), $("#srchPsSendungNbAlert")); fn_alert_hide($("#srchPsSendungNb"), $("#srchPsSendungNbAlert"));
$('.certInp').on('keydown', function(e) { $('.certInp').on('keydown', function(e) {
if (e.keyCode == 13) { if (e.keyCode == 13) {
$('.phoneAuthBtn').first().click(); $('.emailAuthBtn').first().click();
} }
}); });
$('.certNb').on('keydown', function(e) { $('.certNb').on('keydown', function(e) {
if (e.keyCode == 13) { if (e.keyCode == 13) {
fn_confim_own(); fn_confim_own_email();
// fn_confim_own();
} }
}); });
}); });
@@ -75,13 +79,14 @@
//입력값 초기화 //입력값 초기화
first = 0; first = 0;
certNb = ''; certNb = '';
fn_stop_timer(); fn_stop_email_timer();
// fn_stop_timer();
$('.input-text').val(''); $('.input-text').val('');
if(isChkd_own){ if(isChkd_own){
$('.input-text').attr("readonly", false); $('.input-text').attr("readonly", false);
$('.phoneAuthBtn').show(); $('.emailAuthBtn').show();
$('.phoneAuthOkBtn').hide(); $('.emailAuthOkBtn').hide();
$('#resIdForm').hide(); $('#resIdForm').hide();
$('#resPswdForm').hide(); $('#resPswdForm').hide();
isChkd_own = false; isChkd_own = false;
@@ -104,6 +109,52 @@
$('#findPswd').click(); $('#findPswd').click();
} }
/* ********************************************************
* 이메일 인증 버튼 클릭시, 이메일 인증 박스 노출
******************************************************** */
const fn_show_emailAuth = function() {
let emailAuthBtn = $('.emailAuthBtn');
let emailAuthContent = $('.emailAuthContent');
emailAuthContent.hide();
emailAuthBtn.click(function () {
if (findType === 'id') {
if(!$('#srchIdMbrNm').val()){
$('#srchIdMbrNm').focus();
fn_alert_show('이름을 입력해 주세요.');
return;
}else if(!$('#srchIdEmail').val()){
$('#srchIdEmail').focus();
fn_alert_show('이메일 주소를 입력해 주세요.');
return;
}
$('#reqIdForm .emailAuthContent').show();
$('#srchIdSendungNb').focus();
}else {
if(!$('#srchPsMbrNm').val()){
$('#srchPsMbrNm').focus();
fn_alert_show('이름을 입력해 주세요.');
return;
}else if(!$('#srchPsMbrId').val()){
$('#srchPsMbrId').focus();
fn_alert_show('아이디를 입력해 주세요.');
return;
}else if(!$('#srchPsEmail').val()){
$('#srchPsEmail').focus();
fn_alert_show('이메일 주소를 입력해 주세요.');
return;
}
$('#reqPswdForm .emailAuthContent').show();
$('#srchPsSendungNb').focus();
}
fn_email_sending_number();
});
}
/* ******************************************************** /* ********************************************************
* 휴대폰 인증 버튼 클릭시, 휴대폰 인증 박스 노출 * 휴대폰 인증 버튼 클릭시, 휴대폰 인증 박스 노출
******************************************************** */ ******************************************************** */
@@ -168,11 +219,83 @@
seconds--; seconds--;
} else { } else {
fn_stop_timer(); fn_stop_email_timer();
// fn_stop_timer();
fn_alert_show('인증번호 유효시간이 만료되었습니다.'); fn_alert_show('인증번호 유효시간이 만료되었습니다.');
} }
} }
/* ********************************************************
* 이메일 인증 번호 발송
******************************************************** */
first = 0;
certNb = '';
const fn_email_sending_number = function() {
if(timerRunning){
return;
}
let mbrEmail;
let mbrNm;
if (findType === 'id') {
mbrEmail = $('#srchIdEmail').val();
mbrNm = $('#srchIdMbrNm').val();
} else {
mbrEmail = $('#srchPsEmail').val();
mbrNm = $('#srchPsMbrNm').val();
}
if(certNb === mbrEmail){
first++;
}else{
first = 0;
}
certNb = mbrEmail;
let params = {
'mbrNm' : mbrNm,
'email': mbrEmail
};
$.ajax({
type : 'post',
url : '<c:url value="/sopmal/mbr/insertEmailAuth"/>',
data : params,
success : function (Data) {
let result = JSON.parse(Data.resBody.result);
if(result.result == "success"){
if (first > 0) {
fn_alert_show('인증번호가 재발송되었습니다.');
} else if (first === 0) {
fn_alert_show('인증번호가 발송되었습니다.');
first++;
} else {
return;
}
let sndngInnb = (findType === 'id') ? $('#srchIdForm .sndngInnb') : $('#srchPswdForm .sndngInnb');
sndngInnb.val(result.sndngInnb);
}else {
fn_alert_show('인증번호 발송에 실패했습니다.');
fn_stop_email_timer();
return;
}
}
});
$('.input-text').attr("readonly", true);
$('.certNb').attr("readonly", false);
clearInterval(countdown);
seconds = 300;
fn_set_timeOut();
countdown = setInterval(fn_set_timeOut, 1000);
timerRunning = true;
}
/* ******************************************************** /* ********************************************************
* 휴대폰 인증 번호 발송 * 휴대폰 인증 번호 발송
******************************************************** */ ******************************************************** */
@@ -248,6 +371,22 @@
timerRunning = true; timerRunning = true;
} }
/* ********************************************************
* 타이머 정지 함수 (이메일)
******************************************************** */
const fn_stop_email_timer = function() {
if (timerRunning) {
clearInterval(countdown);
$('.timer').text('05:00');
$('.certNb').val('');
$('.emailAuthContent').hide();
$('.input-text').attr("readonly", false);
timerRunning = false;
}
}
/* ******************************************************** /* ********************************************************
* 타이머 정지 함수 * 타이머 정지 함수
******************************************************** */ ******************************************************** */
@@ -264,6 +403,126 @@
} }
} }
/* ********************************************************
* 이메일 인증 확인
******************************************************** */
isChkd_own = false;
const fn_confim_own_email = function() {
if (first <= 0) return;
let sndngInnb;
let mbrEmail;
let crtnb;
if (findType === 'id') {
sndngInnb = $('#srchIdForm .sndngInnb').val();
mbrEmail = $('#srchIdEmail').val();
crtnb = $('#srchIdSendungNb').val();
} else {
sndngInnb = $('#srchPswdForm .sndngInnb').val();
mbrEmail = $('#srchPsEmail').val();
crtnb = $('#srchPsSendungNb').val();
}
fn_stop_email_timer();
let params = {
'sndngInnb': sndngInnb,
'email': mbrEmail,
'crtnb' : crtnb
};
$.ajax({
type : 'post',
url : '<c:url value="/sopmal/mbr/selectEmailAuth"/>',
data : params,
success : function (Data) {
let result = JSON.parse(Data.resBody.result);
if(result.result == "success"){
fn_alert_show('인증되었습니다.');
$('.emailAuthOkBtn').show();
$('.emailAuthBtn').hide();
isChkd_own = true;
fn_select_infor_email();
$('.input-text').attr("readonly", true);
}else {
fn_alert_show('인증번호가 일치하지 않습니다.');
return;
}
}
});
}
/* ********************************************************
* 아이디 패스워드 조회(이메일)
******************************************************** */
const fn_select_infor_email = function() {
let mbrId = '';
let mbrEmail = '';
let mbrNm = '';
let url = '';
if (findType === 'id') {
url = '<c:url value="/sopmal/mbr/selectIdSearchEmail"/>';
mbrNm = $('#srchIdMbrNm').val().trim();
mbrEmail = $('#srchIdEmail').val().trim();
} else {
url = '<c:url value="/sopmal/mbr/selectPasswordSearchEmail"/>';
mbrNm = $('#srchPsMbrNm').val().trim();
mbrId = $('#srchPsMbrId').val().trim();
mbrEmail = $('#srchPsEmail').val().trim();
}
let params = {
'mbrId' : mbrId,
'email': mbrEmail,
'mbrNm' : mbrNm
};
$.ajax({
type : 'post',
url : url,
data : params,
success : function(data) {
let result = JSON.parse(data.resBody.result);
if (findType === 'id') {
$('#reqIdForm').hide();
$('#resIdForm').show();
if(result.result == "success"){
$('#resIdForm').find('.userId').text(result.selectId);
$('.findSuccess').show();
$('.findFail').hide();
}else {
$('.findSuccess').hide();
$('.findFail').show();
}
} else if (findType === 'pswd') {
$('#reqPswdForm').hide();
$('#resPswdForm').show();
if(result.result == "success"){
let message = '회원님의 이메일(' + mbrEmail + ')';
$('#resPswdForm').find('.mbem').text(message);
$('.findSuccess').show();
$('.findFail').hide();
}
else {
$('.findSuccess').hide();
$('.findFail').show();
}
}
}
});
}
/* ******************************************************** /* ********************************************************
* 휴대폰 인증 확인 * 휴대폰 인증 확인
******************************************************** */ ******************************************************** */
@@ -453,20 +712,36 @@
<div class="login__inputBox"> <div class="login__inputBox">
<input class="input-text full" type="text" id="srchIdMbrNm" name="mbrNm" title="이름" placeholder="이름"> <input class="input-text full" type="text" id="srchIdMbrNm" name="mbrNm" title="이름" placeholder="이름">
<p class="login__inputBox__alertText" id="srchIdMbrNmAlert">이름을 입력해 주세요.</p> <p class="login__inputBox__alertText" id="srchIdMbrNmAlert">이름을 입력해 주세요.</p>
<%-- <div class="inputWithBtn">--%>
<%-- <input type="text" class="input-text full number" id="srchIdPhoneNb" name="mbtlnb" title="휴대폰" placeholder="휴대폰번호 입력 (’-’ 없이)" oninput="fn_set_event(this, 'keyup', fn_fmt_telno)" maxlength="13">--%>
<%-- <button type="button" class="btn md theme outline phoneAuthBtn"><spring:message code="button.certification"/></button>--%>
<%-- <!-- 인증완료시 버튼 -->--%>
<%-- <button type="button" class="btn md outline phoneAuthOkBtn" style="display:none;"><spring:message code="button.certificationDone"/></button>--%>
<%-- </div>--%>
<%-- <p class="login__inputBox__alertText" id="srchIdPhoneNbAlert">휴대폰번호를 입력해 주세요.</p>--%>
<%-- <div class="inputWithBtn phoneAuthContent">--%>
<%-- <input type="hidden" class="sndngInnb">--%>
<%-- <div class="inputTimer">--%>
<%-- <input type="text" class="input-text full number certNb" id="srchIdSendungNb" title="인증번호" placeholder="인증번호 입력" maxlength="6">--%>
<%-- <span class="inputTimer__time timer">03:00</span>--%>
<%-- </div>--%>
<%-- <button type="button" class="btn md gray" onclick="fn_confim_own();"><spring:message code="button.ok"/></button>--%>
<%-- </div>--%>
<%-- <p class="login__inputBox__alertText" id="srchIdSendungNbAlert">인증번호를 입력해 주세요.</p>--%>
<div class="inputWithBtn"> <div class="inputWithBtn">
<input type="text" class="input-text full number" id="srchIdPhoneNb" name="mbtlnb" title="휴대폰" placeholder="휴대폰번호 입력 (’-’ 없이)" oninput="fn_set_event(this, 'keyup', fn_fmt_telno)" maxlength="13"> <input type="text" class="input-text full" id="srchIdEmail" name="mbrEmail" title="이메일" placeholder="이메일을 입력해주세요" maxlength="190">
<button type="button" class="btn md theme outline phoneAuthBtn"><spring:message code="button.certification"/></button> <button type="button" class="btn md theme outline emailAuthBtn"><spring:message code="button.certificationEmail"/></button>
<!-- 인증완료시 버튼 --> <!-- 인증완료시 버튼 -->
<button type="button" class="btn md outline phoneAuthOkBtn" style="display:none;"><spring:message code="button.certificationDone"/></button> <button type="button" class="btn md outline emailAuthOkBtn" style="display:none;"><spring:message code="button.certificationDone"/></button>
</div> </div>
<p class="login__inputBox__alertText" id="srchIdPhoneNbAlert">휴대폰번호를 입력해 주세요.</p> <p class="login__inputBox__alertText" id="srchIdEmailAlert">이메일 주소를 입력해 주세요.</p>
<div class="inputWithBtn phoneAuthContent"> <div class="inputWithBtn emailAuthContent">
<input type="hidden" class="sndngInnb"> <input type="hidden" class="sndngInnb">
<div class="inputTimer"> <div class="inputTimer">
<input type="text" class="input-text full number certNb" id="srchIdSendungNb" title="인증번호" placeholder="인증번호 입력" maxlength="6"> <input type="text" class="input-text full number certNb" id="srchIdSendungNb" title="인증번호" placeholder="인증번호 입력" maxlength="6">
<span class="inputTimer__time timer">03:00</span> <span class="inputTimer__time timer">05:00</span>
</div> </div>
<button type="button" class="btn md gray" onclick="fn_confim_own();"><spring:message code="button.ok"/></button> <button type="button" class="btn md gray" onclick="fn_confim_own_email();"><spring:message code="button.ok"/></button>
</div> </div>
<p class="login__inputBox__alertText" id="srchIdSendungNbAlert">인증번호를 입력해 주세요.</p> <p class="login__inputBox__alertText" id="srchIdSendungNbAlert">인증번호를 입력해 주세요.</p>
</div> </div>
@@ -483,7 +758,7 @@
</div> </div>
<div class="login__btnContainer-half"> <div class="login__btnContainer-half">
<button type="button" class="btn xl full outline login__loginBtn findSuccess" onclick="fn_move_tapFindPwsd();">비밀번호 찾기</button> <button type="button" class="btn xl full outline login__loginBtn findSuccess" onclick="fn_move_tapFindPwsd();">비밀번호 찾기</button>
<a href="<c:url value='/login'/>" class="btn xl full dark login__loginBtn findSuccess">로그인</a> <a href="<c:url value='/sopmal/mbr/selectUsrLoginForm'/>" class="btn xl full dark login__loginBtn findSuccess">로그인</a>
<button type="button" class="btn xl full outline login__loginBtn findFail" onclick="fn_move_tapFindId();">아이디 찾기</button> <button type="button" class="btn xl full outline login__loginBtn findFail" onclick="fn_move_tapFindId();">아이디 찾기</button>
<a href="<c:url value='/sopmal/mbr/selectJoinGuidance'/>" class="btn xl full dark login__loginBtn findFail">회원가입</a> <a href="<c:url value='/sopmal/mbr/selectJoinGuidance'/>" class="btn xl full dark login__loginBtn findFail">회원가입</a>
</div> </div>
@@ -496,20 +771,36 @@
<p class="login__inputBox__alertText" id="srchPsMbrNmAlert">이름을 입력해 주세요.</p> <p class="login__inputBox__alertText" id="srchPsMbrNmAlert">이름을 입력해 주세요.</p>
<input type="text" class="input-text full certInp" id="srchPsMbrId" name="mbrId" title="아이디" placeholder="아이디"> <input type="text" class="input-text full certInp" id="srchPsMbrId" name="mbrId" title="아이디" placeholder="아이디">
<p class="login__inputBox__alertText" id="srchPsMbrIdAlert">아이디를 입력해 주세요.</p> <p class="login__inputBox__alertText" id="srchPsMbrIdAlert">아이디를 입력해 주세요.</p>
<%-- <div class="inputWithBtn">--%>
<%-- <input type="text" class="input-text full number certInp" id="srchPsPhoneNb" name="mbtlnb" title="휴대폰" placeholder="휴대폰번호 입력 (’-’ 없이)" oninput="fn_set_event(this, 'keyup', fn_fmt_telno)" maxlength="13">--%>
<%-- <button type="button" class="btn md theme outline phoneAuthBtn"><spring:message code="button.certification"/></button>--%>
<%-- <!-- 인증완료시 버튼 -->--%>
<%-- <button type="button" class="btn md outline phoneAuthOkBtn" style="display:none;"><spring:message code="button.certificationDone"/></button>--%>
<%-- </div>--%>
<%-- <p class="login__inputBox__alertText" id="srchPsPhoneNbAlert">휴대폰번호를 입력해 주세요.</p>--%>
<%-- <div class="inputWithBtn phoneAuthContent">--%>
<%-- <input type="hidden" class="sndngInnb">--%>
<%-- <div class="inputTimer">--%>
<%-- <input type="text" class="input-text full number certNb" id="srchPsSendungNb" title="인증번호" placeholder="인증번호 입력" maxlength="6">--%>
<%-- <span class="inputTimer__time timer">03:00</span>--%>
<%-- </div>--%>
<%-- <button type="button" class="btn md gray" onclick="fn_confim_own();"><spring:message code="button.ok"/></button>--%>
<%-- </div>--%>
<%-- <p class="login__inputBox__alertText" id="srchPsSendungNbAlert">인증번호를 입력해 주세요.</p>--%>
<div class="inputWithBtn"> <div class="inputWithBtn">
<input type="text" class="input-text full number certInp" id="srchPsPhoneNb" name="mbtlnb" title="휴대폰" placeholder="휴대폰번호 입력 (’-’ 없이)" oninput="fn_set_event(this, 'keyup', fn_fmt_telno)" maxlength="13"> <input type="text" class="input-text full" id="srchPsEmail" name="mbrEmail" title="이메일" placeholder="이메일을 입력해주세요" maxlength="190">
<button type="button" class="btn md theme outline phoneAuthBtn"><spring:message code="button.certification"/></button> <button type="button" class="btn md theme outline emailAuthBtn"><spring:message code="button.certificationEmail"/></button>
<!-- 인증완료시 버튼 --> <!-- 인증완료시 버튼 -->
<button type="button" class="btn md outline phoneAuthOkBtn" style="display:none;"><spring:message code="button.certificationDone"/></button> <button type="button" class="btn md outline emailAuthOkBtn" style="display:none;"><spring:message code="button.certificationDone"/></button>
</div> </div>
<p class="login__inputBox__alertText" id="srchPsPhoneNbAlert">휴대폰번호를 입력해 주세요.</p> <p class="login__inputBox__alertText" id="srchPsEmailAlert">이메일 주소를 입력해 주세요.</p>
<div class="inputWithBtn phoneAuthContent"> <div class="inputWithBtn emailAuthContent">
<input type="hidden" class="sndngInnb"> <input type="hidden" class="sndngInnb">
<div class="inputTimer"> <div class="inputTimer">
<input type="text" class="input-text full number certNb" id="srchPsSendungNb" title="인증번호" placeholder="인증번호 입력" maxlength="6"> <input type="text" class="input-text full number certNb" id="srchPsSendungNb" title="인증번호" placeholder="인증번호 입력" maxlength="6">
<span class="inputTimer__time timer">03:00</span> <span class="inputTimer__time timer">05:00</span>
</div> </div>
<button type="button" class="btn md gray" onclick="fn_confim_own();"><spring:message code="button.ok"/></button> <button type="button" class="btn md gray" onclick="fn_confim_own_email();"><spring:message code="button.ok"/></button>
</div> </div>
<p class="login__inputBox__alertText" id="srchPsSendungNbAlert">인증번호를 입력해 주세요.</p> <p class="login__inputBox__alertText" id="srchPsSendungNbAlert">인증번호를 입력해 주세요.</p>
</div> </div>
@@ -518,24 +809,24 @@
<div id="resPswdForm" style="display: none;"> <div id="resPswdForm" style="display: none;">
<div class="login__findResult"> <div class="login__findResult">
<p class="findSuccess"> <p class="findSuccess">
<em class="mbph"></em>으로<br>임시 비밀번호가 <em class="mbem"></em>으로<br>임시 비밀번호가
발송되었습니다. 발송되었습니다.
<br> <br>
SMS를 확인 부탁 드립니다. 이메일을확인 부탁 드립니다.
</p> </p>
<p class="findFail"> <p class="findFail">
<span style="color:red;">일치하는 정보가 없습니다.</span><br>아이디 찾기 방법을 변경하거나 회원가입을 해주세요. <span style="color:red;">일치하는 정보가 없습니다.</span><br>아이디 찾기 방법을 변경하거나 회원가입을 해주세요.
</p> </p>
</div> </div>
<a href="<c:url value='/login'/>" class="btn xl full dark login__loginBtn findSuccess">로그인</a> <a href="<c:url value='/sopmal/login'/>" class="btn xl full dark login__loginBtn findSuccess">로그인</a>
<div class="login__btnContainer-half findFail"> <div class="login__btnContainer-half findFail">
<button type="button" class="btn xl full outline login__loginBtn" onclick="fn_move_tapFindPwsd();">비밀번호 찾기</button> <button type="button" class="btn xl full outline login__loginBtn" onclick="fn_move_tapFindPwsd();">비밀번호 찾기</button>
<a href="<c:url value='/sopmal/mbr/selectJoinGuidance'/>" class="btn xl full dark login__loginBtn">회원가입</a> <a href="<c:url value='/sopmal/mbr/selectJoinGuidance'/>" class="btn xl full dark login__loginBtn">회원가입</a>
</div> </div>
<p class="textInfo findSuccess"><i class="icon icon_textInfo--sm"></i>SNS 계정으로 가입한 회원의 비밀번호는 저장하지 있지 않으며, 해당 <%-- <p class="textInfo findSuccess"><i class="icon icon_textInfo--sm"></i>SNS 계정으로 가입한 회원의 비밀번호는 저장하지 있지 않으며, 해당--%>
SNS <%-- SNS--%>
서비스 제공시에 문의하시길 바랍니다. <%-- 서비스 제공시에 문의하시길 바랍니다.--%>
</p> <%-- </p>--%>
</div> </div>
</div> </div>
</div> </div>