비밀번호 변경/초기화 관련 수정

dev
mjkhan21 5 months ago
parent 76ca81f44f
commit 38b98de692

@ -49,6 +49,8 @@ propertyService:
- pageSize: 10 - pageSize: 10
# 테스트를 위해 permitAccess 설정 # 테스트를 위해 permitAccess 설정
- permitAccess: /intf/**/* - permitAccess: /intf/**/*
- defaultPassword: 0
# extFileName: # extFileName:
# - encoding: UTF-8 # - encoding: UTF-8
# filename: classpath*:properties/your-file-01.properties # filename: classpath*:properties/your-file-01.properties
@ -76,6 +78,7 @@ spring:
propertyService: propertyService:
properties: properties:
- tempDir: C:\temppp - tempDir: C:\temppp
- defaultPassword: 0
app: app:
api: api:
@ -105,6 +108,7 @@ server:
propertyService: propertyService:
properties: properties:
- tempDir: C:\temp - tempDir: C:\temp
- defaultPassword: 0
app: app:
api: api:

@ -85,12 +85,12 @@ SELECT USER_ID
<select id="getUser" parameterType="map" resultMap="userRow">/* 사용자 계정 가져오기(userMapper.getUser) */ <select id="getUser" parameterType="map" resultMap="userRow">/* 사용자 계정 가져오기(userMapper.getUser) */
SELECT * SELECT *
FROM TB_USER FROM TB_USER
WHERE USER_ACNT = #{account} <where><if test="userID != null">AND USER_ID = #{userID}</if>
AND NSTT_CD = #{institute}</select> <if test="account != null">AND USER_ACNT = #{account}</if>
<if test="institute != null"> AND NSTT_CD = #{institute}</if></where></select>
<insert id="insertUser" parameterType="cokr.xit.base.user.ManagedUser"> <insert id="insertUser" parameterType="cokr.xit.base.user.ManagedUser">/* 사용자 정보 등록(userMapper.insertUser) */
<selectKey resultType="string" keyProperty="id" keyColumn="NEW_ID" order="BEFORE">SELECT LPAD(NVL(MAX(USER_ID) + 1, 1), 10, '0') NEW_ID FROM TB_USER</selectKey> <selectKey resultType="string" keyProperty="id" keyColumn="NEW_ID" order="BEFORE">SELECT LPAD(NVL(MAX(USER_ID) + 1, 1), 10, '0') NEW_ID FROM TB_USER</selectKey>
/* 사용자 정보 등록(userMapper.insertUser) */
INSERT INTO TB_USER ( INSERT INTO TB_USER (
USER_ID USER_ID
, USER_ACNT , USER_ACNT
@ -187,8 +187,8 @@ UPDATE TB_USER SET
WHERE USER_ID = #{id}</update> WHERE USER_ID = #{id}</update>
<update id="changePassword" parameterType="map">/* 비밀번호 변경(userMapper.changePassword) */ <update id="changePassword" parameterType="map">/* 비밀번호 변경(userMapper.changePassword) */
UPDATE TB_USER SET UPDATE TB_USER
PASSWD = CASE USER_ID<foreach collection="userPasswords" item="userPassword" separator=" "> SET PASSWD = CASE USER_ID<foreach collection="userPasswords" item="userPassword" separator=" ">
WHEN #{userPassword.userID} THEN #{userPassword.password}</foreach> WHEN #{userPassword.userID} THEN #{userPassword.password}</foreach>
ELSE PASSWD END ELSE PASSWD END
, MDFCN_DT =<include refid="utility.now" /> , MDFCN_DT =<include refid="utility.now" />

@ -0,0 +1,80 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<form id="change-password">
<div class="row g-3">
<div class="col-md-12">
<div class="row">
<label class="col-sm-4 col-form-label text-sm-end required" for="currentPassword">현재 비밀번호</label>
<div class="col-sm-8"><input name="currentPassword" type="password" required class="form-control" /></div>
</div>
</div>
<div class="col-md-12">
<div class="row">
<label class="col-sm-4 col-form-label text-sm-end required" for="password">새 비밀번호</label>
<div class="col-sm-8"><input name="password" type="password" required class="form-control" /></div>
</div>
</div>
<div class="col-md-12">
<div class="row">
<label class="col-sm-4 col-form-label text-sm-end required" for="confirmPassword">비밀번호 확인</label>
<div class="col-sm-8"><input name="confirmPassword" type="password" required class="form-control" /></div>
</div>
</div>
</div>
</form>
<script>
function changePassword() {
if (!$("#change-password input").validInputs())
return false;
let passwords = document.querySelectorAll("#change-password input[type='password']");
if (passwords[0].value == passwords[1].value) {
dialog.alert("현재 비밀번호와 새 비밀번호가 같습니다.");
return false;
}
if (passwords[1].value != passwords[2].value) {
dialog.alert("새 비밀번호와 비밀번호 확인이 다릅니다.");
return false;
}
return currentUserControl.changePassword({
userIDs: "${currentUser.id}",
currentPassword: passwords[0].value,
password: passwords[1].value
})
.then(resp => {
if (!resp.saved) {
dialog.alert("현재 비밀번호가 잘못됐습니다.");
} else {
dialog.alert({
content: "비밀번호가 변경됐습니다.<br />다시 로그인하시기 바랍니다.",
onClose: () => logout(false)
});
}
});
}
$(function() {
$("#change-password input").onEnterPress(() => changePassword());
});
<%--
function savePassword(){
ajax.post({
url : wctx.url("/user/changePassword.do"),
data : {
userID : MY_INFO.id,
password : $("#change-password input[name='password']").val()
},
success : (resp) => {
if(resp.saved){
dialog.alert("비밀번호 변경에 성공하였습니다.");
dialog.close("changePasswordDialog");
} else {
dialog.alert("비밀번호 변경에 실패하였습니다.");
}
}
});
}
--%>
//# sourceURL=password.jsp
</script>

@ -142,8 +142,9 @@
<div class="row mt-4 justify-content-end"> <div class="row mt-4 justify-content-end">
<div class="col-md-6"> <div class="col-md-6">
<div class="row justify-content-end"> <div class="row justify-content-end">
<div class="col-sm-3"> <div class="flex-row justify-content-end">
<button onclick="saveinfoPrefix();" type="button" class="btn btn-primary">저장</button> <button onclick="saveinfoPrefix();" type="button" class="btn btn-primary">저장</button>
<button onclick="initPassword();" type="button" class="btn btn-primary">비밀번호 초기화</button>
</div> </div>
</div> </div>
</div> </div>
@ -207,5 +208,31 @@ function saveinfoPrefix() {
} }
}); });
} }
function _initPassword() {
let resp = userControl.changePassword({
userIDs: userControl.getCurrent().USER_ID,
init: true
});
if (resp.saved)
dialog.alert("비밀번호가 초기화됐습니다.");
}
async function initPassword() {
dialog.alert({
title: "비밀번호 초기화",
content: "비밀번호를 초기화하시겠습니까?",
onOK: () => {
userControl.changePassword({
userIDs: userControl.getCurrent().USER_ID,
init: true
})
.then(resp => {
if (resp.saved)
dialog.alert("비밀번호가 초기화됐습니다.");
});
}
});
}
//# sourceURL=user-info.jsp //# sourceURL=user-info.jsp
</script> </script>

@ -61,15 +61,19 @@ wctx.csrf = {
dialog.title = "마약류폐기지원시스템"; dialog.title = "마약류폐기지원시스템";
<c:if test="${currentUser.authenticated}"> <c:if test="${currentUser.authenticated}">
function logout() { function logout(prompt) {
dialog.alert({ let func = () => {
content:"로그아웃 하시겠습니까?",
onOK:function(){
var form = $("<form action=\"<c:url value='/logout.do'/>\", method=\"POST\">"); var form = $("<form action=\"<c:url value='/logout.do'/>\", method=\"POST\">");
$("<input name=\"${_csrf.parameterName}\" value=\"${_csrf.token}\" type=\"hidden\">").appendTo(form); $("<input name=\"${_csrf.parameterName}\" value=\"${_csrf.token}\" type=\"hidden\">").appendTo(form);
form.appendTo("body").submit(); form.appendTo("body").submit();
} };
}); if (prompt !== false)
dialog.alert({
content: "로그아웃 하시겠습니까?",
onOK: func
});
else
func();
}</c:if> }</c:if>
<c:if test="${currentUser.hasAuthorities('ROLE_ADMIN')}"> <c:if test="${currentUser.hasAuthorities('ROLE_ADMIN')}">
@ -92,5 +96,5 @@ async function selectURL(multiple) {
}); });
} }
</c:if> </c:if>
${functions}
${functions}</c:set> </c:set>

@ -37,14 +37,11 @@
</a> </a>
</li> </li>
<li><div class="dropdown-divider"></div></li> <li><div class="dropdown-divider"></div></li>
<!-- 기능 미구현 <li><a class="dropdown-item" onclick="currentUserControl.changePassword()">
<li>
<a class="dropdown-item" href="pages-account-settings-account.html">
<i class="bx bx-cog me-2"></i> <i class="bx bx-cog me-2"></i>
<span class="align-middle">설정</span> <span class="align-middle">비밀번호 변경</span>
</a> </a>
</li> </li>
-->
<li><div class="dropdown-divider"></div></li> <li><div class="dropdown-divider"></div></li>
<li onclick="logout();"> <li onclick="logout();">
<a class="dropdown-item"> <a class="dropdown-item">

@ -146,6 +146,7 @@ $(".sticky-element").sticky({
$(function() { $(function() {
${onload} ${onload}
mainTabs.open(FIRST_PAGE); mainTabs.open(FIRST_PAGE);
<c:if test="${currentUser.info.promptPasswordChange}">currentUserControl.changePassword();</c:if>
}); });
//# sourceURL=index.jsp //# sourceURL=index.jsp

Loading…
Cancel
Save