diff --git a/WebContent/jsp/common/screen/emergency.jsp b/WebContent/jsp/common/screen/emergency.jsp index b98632b..d2a2149 100644 --- a/WebContent/jsp/common/screen/emergency.jsp +++ b/WebContent/jsp/common/screen/emergency.jsp @@ -91,7 +91,10 @@ data: $('#loginForm').serialize(), dataType: 'json', success: function(response) { - if (response.smsAuthRequired) { + if (response.changePassword) { + showChangeInitPassword(response); + } + else if (response.smsAuthRequired) { // SMS 인증 필요 showSmsAuthModal(response); } else if (response.success) { @@ -108,6 +111,13 @@ } }); } + + function showChangeInitPassword(data) { + $('input[name="resetUserId"]').val($('input[name="userId"]').val()); + $('input[name="resetPassword"]').val($('input[name="password"]').val()); + $('#changeInitPassword').hide(); + $('#pwdChgModal').modal('show'); + } // SMS 인증 모달 표시 function showSmsAuthModal(data) { @@ -218,44 +228,39 @@ clearInterval(resendTimer); $('#smsAuthModal').modal('hide'); } - function changePwd(){ + + function checkPwd(){ if ($("input[name=resetUserId]").val() == null || $("input[name=resetUserId]").val().length == 0 ){ alert("<%= localeMessage.getString("login.checkid") %>"); $("input[name=resetUserId]").trigger("focus"); - return; + return false; } if ($("input[name=resetPassword]").val() == null || $("input[name=resetPassword]").val().trim().length == 0 ){ alert("<%= localeMessage.getString("login.checkpwd1") %>"); $("input[name=resetPassword]").trigger("focus"); - return; + return false; } if ($("input[name=changePassword]").val() == null || $("input[name=changePassword]").val().trim().length == 0 ){ alert("<%= localeMessage.getString("login.checkpwd2") %>"); $("input[name=changePassword]").trigger("focus"); - return ; + return false; } if ($("input[name=confirmPassword]").val() == null || $("input[name=confirmPassword]").val().trim().length == 0 ){ alert("<%= localeMessage.getString("login.checkpwd3") %>"); - return ; + return false; } - if ($("input[name=confirmPassword]").val() != $("input[name=confirmPassword]").val()){ + if ($("input[name=changePassword]").val() != $("input[name=confirmPassword]").val()){ alert("<%= localeMessage.getString("login.checkpwd4") %>"); $("input[name=confirmPassword]").trigger("focus"); - return ; + return false; } if ($("input[name=resetUserId]").val() == $("input[name=changePassword]").val()){ alert("<%= localeMessage.getString("login.checkpwd5") %>"); $("input[name=changePassword]").trigger("focus"); - return ; + return false; } - //if (idCheck.checked){ - // setCookie("key",id); - //} - <%-- $("form").attr("action",""); - //$("form").action = "<%=request.getContextPath()%>/changePassword.do"; - --%> - $("form").submit(); + return true; } $(document).ready(function() { @@ -271,14 +276,22 @@ }); $("input[name=changePassword]").keydown(function(event){ if ( event.which == 13 ) { - changePwd(); + $('#modalLoginForm').submit(); } }); $("input[name=confirmPassword]").keydown(function(event){ if ( event.which == 13 ) { - changePwd(); + $('#modalLoginForm').submit(); } }); + // Password Change 링크로 직접 열 때만 초기화 (JS에서 modal('show') 호출 시 relatedTarget 없음) + $('#pwdChgModal').on('show.bs.modal', function(event) { + if (event.relatedTarget) { + $('#modalLoginForm')[0].reset(); + $('#changeInitPassword').show(); + } + }); + $("select[name=serviceType]").change(function(){ fncPreMain(); }); @@ -286,9 +299,7 @@ $("#btn_login").click(function(){ fncPreMain(); }); - $("#changePwd").click(function(){ - changePwd(); - }); + $("#btn_sso_login").click(function(){ fncSsoLogin(); }); @@ -366,7 +377,7 @@ - +