비밀번호 초기화 기능 개선

This commit is contained in:
eactive
2025-09-30 15:35:59 +09:00
parent 5f91ae64d9
commit 0d752cb022
2 changed files with 21 additions and 33 deletions
+17 -29
View File
@@ -86,30 +86,33 @@
$("#loginForm").submit();
}
function changePwd(){
if ($("input[name=userId]").val() == null || $("input[name=userId]").val().length == 0 ){
if ($("input[name=resetUserId]").val() == null || $("input[name=resetUserId]").val().length == 0 ){
alert("<%= localeMessage.getString("login.checkid") %>");
$("input[name=userId]").trigger("focus");
$("input[name=resetUserId]").trigger("focus");
return;
}
if ($("input[name=password]").val() == null || $("input[name=password]").val().trim().length == 0 ){
if ($("input[name=resetPassword]").val() == null || $("input[name=resetPassword]").val().trim().length == 0 ){
alert("<%= localeMessage.getString("login.checkpwd1") %>");
$("input[name=password]").trigger("focus");
$("input[name=resetPassword]").trigger("focus");
return;
}
if ($("input[name=password]").length == 0){
if ($("input[name=changePassword]").val() == null || $("input[name=changePassword]").val().trim().length == 0 ){
alert("<%= localeMessage.getString("login.checkpwd2") %>");
$("input[name=changePassword]").trigger("focus");
return ;
}
if ($("input[name=changePassword]").length == 0){
if ($("input[name=confirmPassword]").val() == null || $("input[name=confirmPassword]").val().trim().length == 0 ){
alert("<%= localeMessage.getString("login.checkpwd3") %>");
return ;
}
if ($("input[name=confirmPassword]").val() != $("input[name=changePassword]").val()){
if ($("input[name=confirmPassword]").val() != $("input[name=confirmPassword]").val()){
alert("<%= localeMessage.getString("login.checkpwd4") %>");
$("input[name=confirmPassword]").trigger("focus");
return ;
}
if ($("input[name=userId]").val() == $("input[name=changePassword]").val()){
if ($("input[name=resetUserId]").val() == $("input[name=changePassword]").val()){
alert("<%= localeMessage.getString("login.checkpwd5") %>");
$("input[name=changePassword]").trigger("focus");
return ;
}
@@ -121,21 +124,6 @@
--%>
$("form").submit();
}
function openPwdChgWindow() {
<%
if(sysMode.equals("T") || sysMode.equals("D")) {
%>
windowOpen("http://ssodev.kbankwithu.com:7010", "PopupWindow", 1024, 768);
<%
} else {
%>
windowOpen("https://ssoap.kbankwithu.com/nls3/clientLogin.jsp", "PopupWindow", 1024, 768);
<%
}
%>
}
$(document).ready(function() {
$("input[name=userId]").keydown(function(event){
@@ -215,18 +203,18 @@
<input type="button" id ="btn_login" class="form-control btn btn-primary rounded submit px-3" value="Login">
</div>
<div style="text-align: right !important;" class="form-group">
<a style="font-size: 12px !important;" href="#pwdChgSsoModal" onclick="openPwdChgWindow()" >Password Change</a>
<!-- <a style="font-size: 12px !important;" href="#pwdChgModal" data-toggle="modal" >Password Change</a> -->
<a style="font-size: 12px !important;" href="#pwdChgModal" data-toggle="modal" >Password Change</a>
</div>
<p style="color:red;"><%=resultMsg %></p>
</form>
</div>
</div>
</div>
</div>
<%-- <div class="modal fade" id="pwdChgModal" tabindex="-1" role="dialog" aria-labelledby="pwdChgModalLabel" aria-hidden="true">
<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">
<div class="modal-header">
@@ -238,10 +226,10 @@
<form name="form" id="modalLoginForm" action="<c:url value="/changePassword.do"/>" method="post">
<div class="modal-body">
<div class="form-group d-flex">
<input type="text" name="userId" class="form-control rounded-left" placeholder="User Id" required>
<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="password" class="form-control rounded-left" placeholder="<%= localeMessage.getString("login.placeholderCurrentPassword") %>" required>
<input type="password" name="resetPassword" class="form-control rounded-left" placeholder="<%= localeMessage.getString("login.placeholderCurrentPassword") %>" required>
</div>
<p><%= localeMessage.getString("login.toChangePasswordMessage") %></p>
<div class="form-group d-flex">
@@ -257,7 +245,7 @@
</form>
</div>
</div>
</div> --%>
</div>
</body>
</html>
@@ -563,14 +563,14 @@ public class MainController implements InterceptorSkipController {
@RequestMapping("/changePassword.do")
public String changePassword(HttpServletRequest request,
String changePassword, String confirmPassword,
String userId, String password) {
String resetUserId, String resetPassword) {
HttpSession session = request.getSession();
try {
// 로그인 User ID 체크.
Optional<UserInfo> userInfoOptional = userInfoService
.findById(userId);
.findById(resetUserId);
if (!userInfoOptional.isPresent()) {
UserAccessLogger.log(request, LOG_CATEGORY_LOGIN, "F",
@@ -604,8 +604,8 @@ public class MainController implements InterceptorSkipController {
}
// 3. 비밀번호 체크
if (!userInfo.getPassword().equals(Seed.encrypt(password))
&& !userInfo.getUserid().equals(userId)) {
if (!userInfo.getPassword().equals(Seed.encrypt(resetPassword))
&& !userInfo.getUserid().equals(resetUserId)) {
UserAccessLogger.log(request, LOG_CATEGORY_LOGIN, "F",
localeMessage
.getString("login.pwdmismatch5"));