초기비밀번호로 로그인시 비밀번호변경 모달 오픈
eapim-admin CI / build (push) Has been cancelled

This commit is contained in:
eastargh
2026-07-01 14:23:55 +09:00
parent 8494758fcd
commit 61d710dd8c
5 changed files with 74 additions and 32 deletions
+42 -29
View File
@@ -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","<c:url value="/changePassword.do"/>");
//$("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 @@
</div>
</div>
<!-- 비밀번호 변경 모달 -->
<div class="modal fade" id="pwdChgModal" tabindex="-1" role="dialog" aria-labelledby="pwdChgModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
@@ -376,13 +387,15 @@
<span aria-hidden="true">X</span>
</button>
</div>
<form name="form" id="modalLoginForm" action="<c:url value="/changePassword.do"/>" method="post">
<form id="modalLoginForm" action="<c:url value="/changePassword.do"/>" method="post" onsubmit="return checkPwd()" novalidate>
<div class="modal-body">
<div class="form-group d-flex">
<input type="text" name="resetUserId" class="form-control rounded-left" placeholder="User Id" required>
</div>
<div class="form-group d-flex">
<input type="password" name="resetPassword" class="form-control rounded-left" placeholder="<%= localeMessage.getString("login.placeholderCurrentPassword") %>" autocomplete="off" required>
<div id="changeInitPassword">
<div class="form-group d-flex">
<input type="text" name="resetUserId" class="form-control rounded-left" placeholder="User Id" required>
</div>
<div class="form-group d-flex">
<input type="password" name="resetPassword" class="form-control rounded-left" placeholder="<%= localeMessage.getString("login.placeholderCurrentPassword") %>" autocomplete="off" required>
</div>
</div>
<p><%= localeMessage.getString("login.toChangePasswordMessage") %></p>
<div class="form-group d-flex">
@@ -393,7 +406,7 @@
</div>
</div>
<div class="modal-footer">
<input type="button" id ="changePwd" class="form-control btn btn-primary rounded submit px-3" value="변경">
<button type="submit" id="changePwd" class="form-control btn btn-primary rounded submit px-3">변경</button>
</div>
</form>
</div>