ID/PASS 찾기 1차 반영
This commit is contained in:
parent
0915b4d19c
commit
acaa27976e
@ -68,6 +68,8 @@ public class Oauth2ResourceConfig extends ResourceServerConfigurerAdapter
|
||||
public void configure(HttpSecurity http) throws Exception
|
||||
{
|
||||
http.authorizeRequests().mvcMatchers("/sys/LoginLog**" ).permitAll(); // 로그인 이력처리
|
||||
http.authorizeRequests().mvcMatchers("/main/SearchIdFind.do" ).permitAll(); // 2026.01.14 나혁제 ID 찾기 추가
|
||||
http.authorizeRequests().mvcMatchers("/main/UserPasswordResetExt.do" ).permitAll(); // 2026.01.14 나혁제 ID 찾기 추가
|
||||
|
||||
http.authorizeRequests().anyRequest().authenticated();
|
||||
}
|
||||
|
||||
@ -9,7 +9,9 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@ -19,9 +21,12 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.urpsys.baseapi.domain.TokenInfo;
|
||||
import com.urpsys.baseapi.common.util.CommonUtil;
|
||||
import com.urpsys.baseapi.common.util.HtmlEmailUtil;
|
||||
import com.urpsys.baseapi.common.util.ResultData;
|
||||
import com.urpsys.baseapi.main.service.MainMenuManageService;
|
||||
import com.urpsys.itmsapi.bbs.service.BBSAdminManageService;
|
||||
import com.urpsys.itmsapi.cmm.service.CmmUseService;
|
||||
import com.urpsys.itmsapi.sys.service.UserManageService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@ -54,6 +59,21 @@ public class MainController
|
||||
@Autowired
|
||||
private BBSAdminManageService bbsMngService;
|
||||
|
||||
@Autowired
|
||||
private UserManageService userManageService; // 2026.01.14 나혁제 추가
|
||||
|
||||
@Autowired
|
||||
private PasswordEncoder passwordEncoder; // 2026.01.14 나혁제 추가
|
||||
|
||||
@Autowired
|
||||
CmmUseService cmmUseService; // 2026.01.14 나혁제 공통코드정보 추출
|
||||
|
||||
@Autowired
|
||||
HtmlEmailUtil htmlEmailUtil; // 2026.01.14 나혁제 비밀번호처리 이메일 처리
|
||||
|
||||
@Value("${custom.front_host_info}")
|
||||
private String strFrontHostInfo;
|
||||
|
||||
/**
|
||||
* Header Page를 조회한다.
|
||||
* @param menuManageVO MenuManageVO
|
||||
@ -125,6 +145,138 @@ public class MainController
|
||||
return ResultData.ok(resBody);
|
||||
}
|
||||
|
||||
/**
|
||||
* ID 찾기
|
||||
* @author urp 인프라본부 나혁제
|
||||
* 작성일 : 2025.01.23
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value="/main/searchIdFind.do")
|
||||
public ResponseEntity<ResultData> searchIdFind( @RequestBody LinkedHashMap<String, Object> requestMap
|
||||
, HttpServletRequest request
|
||||
, HttpServletResponse response
|
||||
) throws Exception
|
||||
{
|
||||
log.info("\n\n\n\n\n");
|
||||
log.info(">>>>>>>>>>>>>>>>>>>>>>>>> /main/searchIdFind.do <<<<<<<<<<<<<<<<<<<<<<<<<");
|
||||
log.info("getRequestURI [{}]", request.getRequestURI() );
|
||||
log.info("입력값 확인 requestMap [{}]", requestMap.toString() );
|
||||
|
||||
LinkedHashMap<String, Object> resBody = new LinkedHashMap<String, Object>();
|
||||
|
||||
String strUserId = userManageService.selectIdFind(requestMap);
|
||||
|
||||
resBody.put("userId", strUserId);
|
||||
|
||||
log.info("<<<<<<<<<<<<<<<<<<<<<<<<< /main/searchIdFind.do >>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||
|
||||
return ResultData.ok(resBody);
|
||||
}
|
||||
|
||||
/**
|
||||
* 비밀번호 초기화 처리(대외)
|
||||
* @author urp 인프라본부 나혁제
|
||||
* 작성일 : 2026.01.14
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequestMapping(value="/main/UserPasswordResetExt.do")
|
||||
public ResponseEntity<ResultData> UserPasswordResetExt( @RequestBody LinkedHashMap<String, Object> requestMap
|
||||
, HttpServletRequest request
|
||||
, HttpServletResponse response
|
||||
) throws Exception
|
||||
{
|
||||
|
||||
log.info("\n\n\n\n\n");
|
||||
log.info(">>>>>>>>>>>>>>>>>>>>>>>>> /main/UserPasswordResetExt.do <<<<<<<<<<<<<<<<<<<<<<<<<");
|
||||
|
||||
log.info("getRequestURI [{}]", request.getRequestURI() );
|
||||
log.info("입력값 확인 requestMap [{}]", requestMap.toString() );
|
||||
|
||||
LinkedHashMap<String, Object> resBody = new LinkedHashMap<String, Object>();
|
||||
|
||||
// 사용자 기본정보 추출
|
||||
LinkedHashMap<String, Object> userInfoMap = userManageService.selectUserById(requestMap);
|
||||
|
||||
if(userInfoMap == null)
|
||||
{
|
||||
resBody.put("resultCd" , -1 );
|
||||
resBody.put("resultMsg", "사용자정보가 존재하지 않습니다." );
|
||||
|
||||
return ResultData.ok(resBody);
|
||||
}
|
||||
else if(CommonUtil.nvl(userInfoMap.get("uniqId")).equals(""))
|
||||
{
|
||||
resBody.put("resultCd" , -1 );
|
||||
resBody.put("resultMsg", "사용자정보가 존재하지 않습니다." );
|
||||
|
||||
return ResultData.ok(resBody);
|
||||
}
|
||||
else if(CommonUtil.nvl(userInfoMap.get("emplyrNm")).equals(""))
|
||||
{
|
||||
resBody.put("resultCd" , -2 );
|
||||
resBody.put("resultMsg", "사용자명이 존재하지 않습니다." );
|
||||
|
||||
return ResultData.ok(resBody);
|
||||
}
|
||||
else if(!CommonUtil.nvl(userInfoMap.get("emplyrNm")).equals(requestMap.get("userNm")))
|
||||
{
|
||||
resBody.put("resultCd" , -3 );
|
||||
resBody.put("resultMsg", "사용자정보가 일치하지 않습니다." );
|
||||
|
||||
return ResultData.ok(resBody);
|
||||
}
|
||||
else if(CommonUtil.nvl(userInfoMap.get("emailAdres")).equals(""))
|
||||
{
|
||||
resBody.put("resultCd" , -4 );
|
||||
resBody.put("resultMsg", "E-mail 이 존재하지 않습니다." );
|
||||
|
||||
return ResultData.ok(resBody);
|
||||
}
|
||||
else if(!CommonUtil.nvl(userInfoMap.get("emailAdres")).equals(requestMap.get("userEmail")))
|
||||
{
|
||||
resBody.put("resultCd" , -5 );
|
||||
resBody.put("resultMsg", "사용자정보가 일치하지 않습니다." );
|
||||
|
||||
return ResultData.ok(resBody);
|
||||
}
|
||||
|
||||
String strResetPassword = CommonUtil.getRandomChar(10);
|
||||
|
||||
log.info("새로운 비밀번호 [{}]", strResetPassword );
|
||||
log.info("새로운 비밀번호 [{}]", passwordEncoder.encode(strResetPassword) );
|
||||
|
||||
requestMap.put("pwd", passwordEncoder.encode(strResetPassword));
|
||||
|
||||
int iResult = userManageService.updatePasswordReset(requestMap);
|
||||
|
||||
// 템플릿 조회
|
||||
LinkedHashMap<String, Object> inCodeMap = new LinkedHashMap<String, Object>();
|
||||
inCodeMap.put("codeId", "SM_003");
|
||||
inCodeMap.put("cd", "3");
|
||||
LinkedHashMap<String, Object> outEmailCodeMap = cmmUseService.selectCmmCodeDetailAsCd(inCodeMap);
|
||||
|
||||
String strMailTemplet = (String)outEmailCodeMap.get("dtlTpl");
|
||||
|
||||
String strMailMsg = strMailTemplet;
|
||||
|
||||
strMailMsg = strMailMsg.replace("#{value10}", CommonUtil.nvl(userInfoMap.get("emplyrNm")) ); // 이름
|
||||
strMailMsg = strMailMsg.replace("#{value02}", strResetPassword ); // 비밀번호
|
||||
strMailMsg = strMailMsg.replace("#{value20}", strFrontHostInfo );
|
||||
|
||||
htmlEmailUtil.SendAlarmInsert( CommonUtil.nvl(userInfoMap.get("emailAdres"))
|
||||
, "비밀번호초기화"
|
||||
, strMailMsg
|
||||
, CommonUtil.nvl(userInfoMap.get("uniqId"))
|
||||
, "1");
|
||||
|
||||
resBody.put("resultCd" , 0 );
|
||||
resBody.put("resultMsg", "정상적으로 처리되었습니다. " );
|
||||
|
||||
log.info("<<<<<<<<<<<<<<<<<<<<<<<<< /main/UserPasswordResetExt.do >>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||
|
||||
return ResultData.ok(resBody);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -63,6 +63,11 @@ public interface UserManageDao
|
||||
// 패스워드 초기화
|
||||
public int updatePasswordReset(LinkedHashMap<String, Object> inMap) throws Exception;
|
||||
|
||||
// 2026.01.14 ID 찾기
|
||||
public String selectIdFind(LinkedHashMap<String, Object> inMap) throws Exception;
|
||||
|
||||
// 2026.01.14 나혁제 ID 로 사용자정보 조회
|
||||
public LinkedHashMap<String, Object> selectUserById(LinkedHashMap<String, Object> inMap) throws Exception;
|
||||
|
||||
|
||||
|
||||
|
||||
@ -144,6 +144,18 @@ public class UserManageService
|
||||
return userManageDao.updatePasswordReset(inMap);
|
||||
}
|
||||
|
||||
// 2026.01.14 ID 찾기
|
||||
public String selectIdFind(LinkedHashMap<String, Object> inMap) throws Exception
|
||||
{
|
||||
return userManageDao.selectIdFind(inMap);
|
||||
}
|
||||
|
||||
// 2026.01.14 나혁제 ID 로 사용자정보 조회
|
||||
public LinkedHashMap<String, Object> selectUserById(LinkedHashMap<String, Object> inMap) throws Exception
|
||||
{
|
||||
return userManageDao.selectUserById(inMap);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -331,6 +331,64 @@
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 2026.01.14 나혁제 ID 찾기 기능 -->
|
||||
<select id="selectIdFind" parameterType="java.util.LinkedHashMap" resultType="String">
|
||||
|
||||
SELECT CONCAT(
|
||||
SUBSTR(TASK_USER_ID, 1, 2)
|
||||
, '**'
|
||||
, SUBSTR(TASK_USER_ID, 4, LENGTH(TASK_USER_ID))
|
||||
) AS userId
|
||||
FROM TB_TASK_USER_INFO
|
||||
WHERE 1=1
|
||||
AND USER_NM = #{userNm}
|
||||
AND EML_ADDR = #{userEmail}
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 2026.01.14 나혁제 ID 로 사용자정보 조회 -->
|
||||
<select id="selectUserById" parameterType="java.util.LinkedHashMap" resultType="java.util.LinkedHashMap">
|
||||
|
||||
SELECT
|
||||
ESNTL_ID uniqId
|
||||
, TASK_USER_ID emplyrId
|
||||
, USER_NM emplyrNm
|
||||
, PWD password
|
||||
, PWD_HINT passwordHint
|
||||
, PWD_RANS passwordCnsr
|
||||
, EMPNO emplNo
|
||||
, RRNO ihidnum
|
||||
, SEX_CD sexdstnCode
|
||||
, BIRTH brth
|
||||
, REGN_NO areaNo
|
||||
, HOUSE_MIDDLE_TELNO homemiddleTelno
|
||||
, HOUSE_END_TELNO homeendTelno
|
||||
, FAX_NO fxnum
|
||||
, HOUSE_ADRES homeadres
|
||||
, ADDR2 detailAdres
|
||||
, ZIP_NO zip
|
||||
, OFFM_TELNO offmTelno
|
||||
, MOVE_TELNO moblphonNo
|
||||
, EML_ADDR emailAdres
|
||||
, JBPS_NM ofcpsNm
|
||||
, GRP_ID groupId
|
||||
, ORG_ID orgnztId
|
||||
, BLNG_ISTT_CD insttCode
|
||||
, USER_STACD emplyrSttusCode
|
||||
, JOIN_DTM sbscrbDe
|
||||
, CRTFC_DN_VALUE subDn
|
||||
, LOCK_AT lockAt
|
||||
, KATALK_ALAM_YN katalkAlamYn
|
||||
, MAIL_ALAM_YN mailAlamYn
|
||||
FROM TB_TASK_USER_INFO
|
||||
WHERE 1=1
|
||||
AND TASK_USER_ID = #{userId}
|
||||
AND USER_NM = #{userNm}
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<update id="updateLockIncorrect" parameterType="java.util.LinkedHashMap" >
|
||||
UPDATE TB_TASK_USER_INFO
|
||||
SET LOCK_AT = NULL
|
||||
|
||||
Loading…
Reference in New Issue
Block a user