feat : 비밀번호찾기(재설정) 완료
parent
65f2ce3a57
commit
a0bbe60abd
|
|
@ -118,7 +118,8 @@ public class SecurityConfig{
|
||||||
"/js/**",
|
"/js/**",
|
||||||
"/vendor/**",
|
"/vendor/**",
|
||||||
"/login",
|
"/login",
|
||||||
"/Crosseditor/uploadImg"
|
"/Crosseditor/uploadImg",
|
||||||
|
"/user/findUser"
|
||||||
).permitAll() // 권한 없이 접근 허용
|
).permitAll() // 권한 없이 접근 허용
|
||||||
.antMatchers(
|
.antMatchers(
|
||||||
"/dashboard",
|
"/dashboard",
|
||||||
|
|
@ -172,6 +173,8 @@ public class SecurityConfig{
|
||||||
http.headers().frameOptions().sameOrigin();
|
http.headers().frameOptions().sameOrigin();
|
||||||
// 나모에디터 이미지 업로드시 csrf 토큰을 추가할 수 없어서 예외처리.
|
// 나모에디터 이미지 업로드시 csrf 토큰을 추가할 수 없어서 예외처리.
|
||||||
http.csrf().ignoringAntMatchers("/Crosseditor/uploadImg");
|
http.csrf().ignoringAntMatchers("/Crosseditor/uploadImg");
|
||||||
|
// 비밀번호찾기 토큰없이 사용
|
||||||
|
http.csrf().ignoringAntMatchers("/user/findUser");
|
||||||
|
|
||||||
return http.build();
|
return http.build();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,10 @@ package com.dbnt.faisp.main.userInfo;
|
||||||
import com.dbnt.faisp.main.userInfo.model.UserInfo;
|
import com.dbnt.faisp.main.userInfo.model.UserInfo;
|
||||||
import com.dbnt.faisp.main.userInfo.service.UserInfoService;
|
import com.dbnt.faisp.main.userInfo.service.UserInfoService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
|
@ -18,5 +21,15 @@ public class UserInfoController {
|
||||||
public String insertUserInfo(UserInfo insertReqInfo) {
|
public String insertUserInfo(UserInfo insertReqInfo) {
|
||||||
return userInfoService.insertUserInfo(insertReqInfo);
|
return userInfoService.insertUserInfo(insertReqInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/findUser")
|
||||||
|
public Integer findUser(@RequestBody UserInfo ui) {
|
||||||
|
return userInfoService.findUser(ui);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/updateUserPw")
|
||||||
|
public Integer updateUserPw(UserInfo ui) {
|
||||||
|
return userInfoService.updateUserPw(ui);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,6 @@
|
||||||
package com.dbnt.faisp.main.userInfo.mapper;
|
package com.dbnt.faisp.main.userInfo.mapper;
|
||||||
|
|
||||||
import com.dbnt.faisp.main.userInfo.model.*;
|
import com.dbnt.faisp.main.userInfo.model.*;
|
||||||
import com.dbnt.faisp.main.userInfo.model.UserInoutLog;
|
|
||||||
import com.dbnt.faisp.main.userInfo.model.UserRequestLog;
|
|
||||||
import com.dbnt.faisp.main.userInfo.model.PersonnelStatus;
|
|
||||||
import com.dbnt.faisp.main.userInfo.model.UserEdu;
|
|
||||||
import com.dbnt.faisp.util.ParamMap;
|
import com.dbnt.faisp.util.ParamMap;
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
@ -47,4 +43,6 @@ public interface UserInfoMapper {
|
||||||
|
|
||||||
List<UserAlarm> selectAlarmList(UserAlarm userAlarm);
|
List<UserAlarm> selectAlarmList(UserAlarm userAlarm);
|
||||||
Integer selectAlarmListCnt(UserAlarm userAlarm);
|
Integer selectAlarmListCnt(UserAlarm userAlarm);
|
||||||
|
|
||||||
|
Integer selectUserInfo(UserInfo ui);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -235,5 +235,16 @@ public class UserInfoService implements UserDetailsService {
|
||||||
public String selectUserStatus(UserInfoHistory userInfoHistory) {
|
public String selectUserStatus(UserInfoHistory userInfoHistory) {
|
||||||
return userInfoRepository.getUserStatus(userInfoHistory.getUserSeq());
|
return userInfoRepository.getUserStatus(userInfoHistory.getUserSeq());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer findUser(UserInfo ui) {
|
||||||
|
return userInfoMapper.selectUserInfo(ui);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public Integer updateUserPw(UserInfo ui) {
|
||||||
|
UserInfo dbUser = userInfoRepository.findByUserSeq(ui.getUserSeq()).orElse(null);
|
||||||
|
dbUser.setPassword(convertPassword(ui.getPassword()));
|
||||||
|
return userInfoRepository.save(dbUser).getUserSeq();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -451,4 +451,14 @@
|
||||||
inner join menu_mgt b on a.menu_key = b.menu_key
|
inner join menu_mgt b on a.menu_key = b.menu_key
|
||||||
<include refid="selectAlarmListWhere"></include>
|
<include refid="selectAlarmListWhere"></include>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectUserInfo" resultType="Integer" parameterType="UserInfo">
|
||||||
|
select user_seq
|
||||||
|
from user_info
|
||||||
|
where dic_code = #{dicCode}
|
||||||
|
and user_id = #{userId}
|
||||||
|
and user_nm = #{userNm}
|
||||||
|
and phone_no = #{phoneNo}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -128,4 +128,93 @@ function valueCheck(){
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$(document).on('click', '#findPwBtn', function (){
|
||||||
|
if(!$("#fDicCode").val()){
|
||||||
|
alert("공무원식별번호를 입력해주세요.");
|
||||||
|
$('#fDicCode').focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!$("#fUserId").val()){
|
||||||
|
alert("아이디를 입력해주세요.");
|
||||||
|
$('#fUserId').focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!$("#fUserNm").val()){
|
||||||
|
alert("이름을 입력해주세요.");
|
||||||
|
$('#fUserNm').focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!$("#fPhoneNo").val()){
|
||||||
|
alert("휴대폰번호를 입력해주세요.");
|
||||||
|
$('#fPhoneNo').focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const dicCode = $("#fDicCode").val();
|
||||||
|
const userId = $("#fUserId").val();
|
||||||
|
const userNm = $("#fUserNm").val();
|
||||||
|
const phoneNo = $("#fPhoneNo").val();
|
||||||
|
$.ajax({
|
||||||
|
type : 'POST',
|
||||||
|
data : JSON.stringify({dicCode:dicCode,userId:userId,userNm:userNm,phoneNo:phoneNo}),
|
||||||
|
contentType: "application/json; charset=utf-8",
|
||||||
|
url : "/user/findUser",
|
||||||
|
success : function(data) {
|
||||||
|
if(data != ""){
|
||||||
|
$("#findPasswordModal").modal('hide');
|
||||||
|
$("#changeUserSeq").val(data);
|
||||||
|
$("#changePasswordModal").modal('show');
|
||||||
|
}else{
|
||||||
|
alert("일치하는 정보가 없습니다.")
|
||||||
|
};
|
||||||
|
contentFade("out");
|
||||||
|
},
|
||||||
|
error : function(e) {
|
||||||
|
alert("ajax 통신실패.")
|
||||||
|
contentFade("out");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
$(document).on('click', '#changePwBtn', function (){
|
||||||
|
const p1 = document.getElementById('cPw').value;
|
||||||
|
const p2 = document.getElementById('chkPw').value;
|
||||||
|
if(!p1){
|
||||||
|
alert("비밀번호를 입력해주세요.");
|
||||||
|
$('#cPw').focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!p2){
|
||||||
|
alert("비밀번호확인을 입력해주세요.");
|
||||||
|
$('#chkPw').focus();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(p1!=p2) {
|
||||||
|
alert("비밀번호가 일치하지 않습니다. 비밀번호를 재확인해주세요.")
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(confirm("비밀번호를 변경하시겠습니까?")){
|
||||||
|
contentFade("in");
|
||||||
|
const formData = new FormData($("#changePasswordFm")[0]);
|
||||||
|
$.ajax({
|
||||||
|
type : 'POST',
|
||||||
|
data : formData,
|
||||||
|
url : "/user/updateUserPw",
|
||||||
|
processData: false,
|
||||||
|
contentType: false,
|
||||||
|
beforeSend: function (xhr){
|
||||||
|
xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val());
|
||||||
|
},
|
||||||
|
success : function(result) {
|
||||||
|
alert("비밀번호가 변경되었습니다.");
|
||||||
|
contentFade("out");
|
||||||
|
location.reload();
|
||||||
|
},
|
||||||
|
error : function(xhr, status) {
|
||||||
|
alert("비밀번호변경이 실패하였습니다.");
|
||||||
|
contentFade("out");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
@ -46,10 +46,8 @@
|
||||||
<!--<a href="#" data-bs-toggle="modal" data-bs-target="#userInsertModal">회원가입</a>-->
|
<!--<a href="#" data-bs-toggle="modal" data-bs-target="#userInsertModal">회원가입</a>-->
|
||||||
<a href="#" id="joinModalBtn">회원가입</a>
|
<a href="#" id="joinModalBtn">회원가입</a>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="find"><a href="#" data-bs-toggle="modal" data-bs-target="#findPasswordModal">비밀번호 재설정</a></div>
|
||||||
<a href="#">
|
|
||||||
<div class="find">아이디/패스워드찾기</div>
|
|
||||||
</a>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</form>
|
</form>
|
||||||
|
|
@ -63,6 +61,81 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="modal fade" id="findPasswordModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1"
|
||||||
|
aria-labelledby="findPasswordModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog None">
|
||||||
|
<div class="modal-content " id="findPasswordModalContent">
|
||||||
|
<div class="modal-header bg-dark">
|
||||||
|
<h5 class="modal-title text-white" id="userInsertModalLabel">비밀번호 찾기</h5>
|
||||||
|
<button type="button" class="btn-close f-invert" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="mb-3 mt-3 row">
|
||||||
|
<div class="col-1"></div>
|
||||||
|
<label for="dicCode" class="col-sm-3 col-form-label col-form-label-sm text-center ">공무원식별번호</label>
|
||||||
|
<div class="col-sm-7">
|
||||||
|
<input type="text" class="form-control form-control-sm" id="fDicCode" name="dicCode" autocomplete="off">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3 mt-3 row">
|
||||||
|
<div class="col-1"></div>
|
||||||
|
<label for="dicCode" class="col-sm-3 col-form-label col-form-label-sm text-center ">아이디</label>
|
||||||
|
<div class="col-sm-7">
|
||||||
|
<input type="text" class="form-control form-control-sm" id="fUserId" name="userId" autocomplete="off">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3 mt-3 row">
|
||||||
|
<div class="col-1"></div>
|
||||||
|
<label for="dicCode" class="col-sm-3 col-form-label col-form-label-sm text-center ">이름</label>
|
||||||
|
<div class="col-sm-7">
|
||||||
|
<input type="text" class="form-control form-control-sm" id="fUserNm" name="userNm" autocomplete="off">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3 mt-3 row">
|
||||||
|
<div class="col-1"></div>
|
||||||
|
<label for="dicCode" class="col-sm-3 col-form-label col-form-label-sm text-center ">휴대폰번호</label>
|
||||||
|
<div class="col-sm-7">
|
||||||
|
<input type="text" class="form-control form-control-sm" id="fPhoneNo" name="phoneNo" placeholder="휴대폰 번호는 -(하이픈)을 빼고 숫자만 입력해 주세요." autocomplete="off">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="btn btn-sm btn-outline-primary" id="findPwBtn">찾기</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal fade" id="changePasswordModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1"
|
||||||
|
aria-labelledby="findPasswordModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog None">
|
||||||
|
<div class="modal-content " id="changePasswordModalContent">
|
||||||
|
<div class="modal-header bg-dark">
|
||||||
|
<h5 class="modal-title text-white" id="changePasswordModalLabel">비밀번호 변경</h5>
|
||||||
|
<button type="button" class="btn-close f-invert" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form id="changePasswordFm" method="post">
|
||||||
|
<input type="hidden" id="changeUserSeq" name="userSeq">
|
||||||
|
<div class="mb-3 mt-3 row">
|
||||||
|
<div class="col-1"></div>
|
||||||
|
<label for="dicCode" class="col-sm-3 col-form-label col-form-label-sm text-center ">비밀번호</label>
|
||||||
|
<div class="col-sm-7">
|
||||||
|
<input type="password" class="form-control form-control-sm" id="cPw" name="password" autocomplete="off">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mb-3 mt-3 row">
|
||||||
|
<div class="col-1"></div>
|
||||||
|
<label for="dicCode" class="col-sm-3 col-form-label col-form-label-sm text-center ">비밀번호 확인</label>
|
||||||
|
<div class="col-sm-7">
|
||||||
|
<input type="password" class="form-control form-control-sm" id="chkPw" autocomplete="off">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="btn btn-sm btn-outline-primary" id="changePwBtn">변경</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue