Просмотр исходного кода

1.로그인시 미인증 고객 본인인증 처리하는 화면 2.비밀번호 변경 캠페인 추가 3.임시비밀번호 로그인 시 비밀번호 변경 페이지로 이동

jsshin 5 лет назад
Родитель
Сommit
d7373b12c7

+ 20 - 0
src/main/java/com/style24/front/biz/dao/TsfCustomerDao.java

@@ -95,4 +95,24 @@ public interface TsfCustomerDao {
 	 * @since 2021. 03. 08
 	 */
 	void deleteWishList(WishList wishList);
+
+	/**
+	 * 본인인증 처리
+	 *
+	 * @param customer - 고객번호, ci
+	 * @return int - 업데이트 카운트
+	 * @author jsshin
+	 * @since 2021. 03. 11
+	 */
+	int updateCustomerCi(Customer customer);
+
+	/**
+	 * 비밀번호 변경 날짜 업데이트
+	 *
+	 * @param customer - 고객번호
+	 * @return int - 업데이트 카운트
+	 * @author jsshin
+	 * @since 2021. 03. 11
+	 */
+	int updatePasswordDate(Customer customer);
 }

+ 64 - 1
src/main/java/com/style24/front/biz/service/TsfCustomerService.java

@@ -685,13 +685,76 @@ public class TsfCustomerService {
 
 		if (!customer.getCi().equals(custInfo.getCi())) {
 			result.setBoolean("isRelase", false);
-			result.setString("resultMsg","본인인증이 동일하지 않습니다.");
+			result.setString("errorType", "DIFFERENT_CI"); // 계정이 등록된 CI랑 인증한 CI가 다를떄
 			return result;
 		}
+
 		customer.setRegNo(customer.getCustNo());
 		customer.setUpdNo(customer.getCustNo());
 		boolean isRelase = coreCustomerService.saveDormantCustomerRelease(customer);
 		result.setBoolean("isRelase", isRelase);
 		return result;
 	}
+
+	/**
+	 * 본인인증 처리
+	 *
+	 * @param customer - 본인인증키
+	 * @return GagaMap - 결과
+	 * @author jsshin
+	 * @since 2021. 03. 11
+	 */
+	public GagaMap saveCertification(Customer customer) {
+		GagaMap resultMap = new GagaMap();
+		customer.setRegNo(customer.getCustNo());
+		customer.setUpdNo(customer.getCustNo());
+		boolean isSuccess = false;
+		// CI 유효성 체크
+		Customer custInfo = getCustomerFindByCi(customer.getCi());
+		if (custInfo != null) {
+			TsfSession.setAttribute("maskingCustId", custInfo.getMaskingCustId());
+			resultMap.setBoolean("isSuccess", isSuccess);
+			return resultMap;
+		}
+
+		// 1.이력 쌓고
+		coreCustomerService.createCustomerHistory(customer);
+		// 2.CI 업데이트
+		int resultCnt = customerDao.updateCustomerCi(customer);
+		if (resultCnt > 0) {
+			isSuccess = true;
+		}
+		resultMap.setBoolean("isSuccess", isSuccess);
+
+		return resultMap;
+	}
+
+	/**
+	 * 비밀번호 변경 날짜 업데이트
+	 *
+	 * @param customer - 고객번호
+	 * @return GagaMap - 결과
+	 * @author jsshin
+	 * @since 2021. 03. 11
+	 */
+	public GagaMap updatePasswordDate(Customer customer) {
+		GagaMap resultMap = new GagaMap();
+		boolean isSuccess = false;
+		customer.setRegNo(customer.getCustNo());
+		customer.setUpdNo(customer.getCustNo());
+		customer.setPwdChangeDay(60); //30일간 안보여야 하기때문에 (오늘날짜 - 60) 처리
+
+		// 1.이력 쌓고
+		coreCustomerService.createCustomerHistory(customer);
+
+		// 2.비밀번호 변경일자 업데이트
+		int resultCnt = customerDao.updatePasswordDate(customer);
+		if (resultCnt > 0) {
+			isSuccess = true;
+		}
+
+		resultMap.setBoolean("isSuccess", isSuccess);
+
+		return resultMap;
+	}
 }

+ 72 - 10
src/main/java/com/style24/front/biz/web/TsfCustomerController.java

@@ -24,9 +24,11 @@ import com.style24.front.support.controller.TsfBaseController;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.support.SessionStatus;
 import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
 
 
 /**
@@ -234,10 +236,18 @@ public class TsfCustomerController extends TsfBaseController {
 	 * @author jsshin
 	 * @since 2021. 02. 17
 	 */
-	@GetMapping("password/change/form")
+	@GetMapping("/password/change/form")
 	public ModelAndView passwrodChangeForm(@RequestParam(value = "pageGb")String pageGb) {
 		ModelAndView mav = new ModelAndView();
-		String custNo = TscSession.getAttribute("custNo");
+		String custNo = "";
+
+		if ("find".equals(pageGb)) { //비밀번호 찾기 사용
+			custNo = TscSession.getAttribute("custNo");
+		}
+
+		if ("temp".equals(pageGb)) { // 비밀번호 변경 캠페인, 임시비밀번호로 로그인시 사용
+			custNo = String.valueOf(TsfSession.getInfo().getCustNo());
+		}
 
 		// 고객번호 없으면 인증화면으로 돌아감
 		if (StringUtils.isBlank(custNo)) {
@@ -252,7 +262,7 @@ public class TsfCustomerController extends TsfBaseController {
 		if (custInfo != null) {
 			mav.addObject("custId", custInfo.getCustId());
 		}
-
+		mav.addObject("pageGb", pageGb);
 		mav.setViewName(super.getDeviceViewName("customer/PasswordChangeForm"));
 		return mav;
 	}
@@ -269,8 +279,14 @@ public class TsfCustomerController extends TsfBaseController {
 	@ResponseBody
 	public GagaMap resetPassword(@RequestBody Customer customer) {
 		GagaMap result = new GagaMap();
-		String custNo = TscSession.getAttribute("custNo");
 		boolean isSuccess = false;
+		String custNo = "";
+		if (TsfSession.isLogin()) {
+			custNo = String.valueOf(TsfSession.getInfo().getCustNo());
+		} else {
+			custNo = TscSession.getAttribute("custNo");
+		}
+
 		if (StringUtils.isBlank(custNo)) {
 			throw new IllegalStateException("고객 정보가 없습니다. 다시 확인 해주세요.");
 		}
@@ -687,16 +703,16 @@ public class TsfCustomerController extends TsfBaseController {
 	 */
 	@PostMapping("/dormant/release")
 	@ResponseBody
-	public GagaMap releaseDormantCustomer(@RequestBody Customer customer) {
+	public GagaMap releaseDormantCustomer(@RequestBody Customer customer, HttpSession session) {
 		String custNo = TsfSession.getAttribute("custNo");
 		if (StringUtils.isBlank(custNo) || StringUtils.isBlank(customer.getEncData())) {
-			throw new IllegalStateException("로그인 후 재인증 해주세요.");
+			throw new IllegalStateException("로그인 다시 시도해주세요.");
 		}
 		GagaMap resultInfo = niceCertify.getCertifyCellPhoneResultInfo(customer);
 
 		customer.setCi(resultInfo.getString("sCi"));
 		customer.setCustNo(Integer.parseInt(custNo));
-
+		session.removeAttribute("custNo"); // 고객번호 세션 삭제
 		return customerService.releaseDormantCustomer(customer);
 	}
 
@@ -721,7 +737,7 @@ public class TsfCustomerController extends TsfBaseController {
 	 *
 	 * @return ModelAndView - 가입완료 화면
 	 * @author jsshin
-	 * @since 2021. 03. 08
+	 * @since 2021. 03. 10
 	 */
 	@GetMapping("/certification/form")
 	public ModelAndView getCertificationForm() {
@@ -732,9 +748,55 @@ public class TsfCustomerController extends TsfBaseController {
 		return mav;
 	}
 
+	/**
+	 * 본인인증 처리
+	 *
+	 * @param customer - 본인인증키
+	 * @return GagaMap - 결과
+	 * @author jsshin
+	 * @since 2021. 03. 11
+	 */
 	@PostMapping("/certification/save")
-	public GagaMap saveCertification(Customer customer) {
-		return  null;
+	@ResponseBody
+	public GagaMap saveCertification(@RequestBody Customer customer, HttpSession session) {
+		String custNo = TsfSession.getAttribute("custNo");
+		if (StringUtils.isBlank(custNo) || StringUtils.isBlank(customer.getEncData())) {
+			throw new IllegalStateException("로그인 다시 시도해 주세요.");
+		}
+		GagaMap resultInfo = niceCertify.getCertifyCellPhoneResultInfo(customer);
+		customer.setCi(resultInfo.getString("sCi"));
+		customer.setCustNo(Integer.parseInt(custNo));
+		session.removeAttribute("custNo"); // 고객번호 세션 삭제
+		return customerService.saveCertification(customer);
 	}
 
+	/**
+	 * 비밀번호 변경 캠페인 화면
+	 *
+	 * @return ModelAndView - 가입완료 화면
+	 * @author jsshin
+	 * @since 2021. 03. 11
+	 */
+	@GetMapping("/password/campaign/form")
+	public ModelAndView getPasswordCampaignnForm() {
+		ModelAndView mav = new ModelAndView();
+
+		mav.setViewName(super.getDeviceViewName("customer/PasswordCampaignForm"));
+
+		return mav;
+	}
+
+	@PostMapping("/password/date/update")
+	@ResponseBody
+	public GagaMap updatePasswordDate(@RequestBody Customer customer) {
+		Integer custNo = TsfSession.getInfo().getCustNo();
+		if (custNo == null) {
+			throw new IllegalStateException("로그인 다시 시도해 주세요.");
+		}
+		customer.setCustNo(custNo);
+		return customerService.updatePasswordDate(customer);
+	}
+
+
+
 }

+ 6 - 4
src/main/java/com/style24/front/support/security/handler/TsfLoginSuccessHandler.java

@@ -45,7 +45,8 @@ public class TsfLoginSuccessHandler implements AuthenticationSuccessHandler {
 		"/customer/pwd/find/form",					// 비밀번호찾기
 		"/customer/join/complete/form",				// 회원가입완료
 		"/customer/join/type/form",					// 회원가입유형
-		"/customer/dormant/certify/complete/form"	// 휴면해제
+		"/customer/dormant/certify/complete/form",	// 휴면해제
+		"/customer/certification/form"				// 본인인증화면
 	};
 	private static final int CHANG_PWD_CAMPAIGN_DAY = 90; // 비밀번호 변경 캠페인일자
 
@@ -116,12 +117,13 @@ public class TsfLoginSuccessHandler implements AuthenticationSuccessHandler {
 		cartService.updateCartToAfterLogin(custNo);
 
 		// 비밀번호 변경 캠페인 일자
-		if (loginDetails.getLoginInfo().getPwdChgDay() > CHANG_PWD_CAMPAIGN_DAY) {
-			returnUrl ="";
+		if (loginDetails.getLoginInfo().getPwdChgDay() >= CHANG_PWD_CAMPAIGN_DAY) {
+			returnUrl ="/customer/password/campaign/form";
 		}
+
 		// 임시비밀번호로 로그인 한 경우
 		if (CHANG_TEMP_PWD.equals(loginDetails.getLoginInfo().getTempPasswdYn())) {
-			returnUrl ="";
+			returnUrl ="/customer/password/change/form?pageGb=temp";
 		}
 
 

+ 41 - 21
src/main/java/com/style24/persistence/mybatis/shop/TsfCustomer.xml

@@ -445,28 +445,27 @@
 	<!-- 위시리스트 등록 -->
 	<insert id="createWishList" parameterType="WishList">
 		/* TsfCustomer.createWishList */
-		INSERT INTO TB_WISHLIST
-		(
-		            CUST_NO
-		          , GOODS_CD
-		          , AF_LINK_CD
-		          , ITHR_CD
-		          , CONTENTS_LOC
-		          , PLAN_DTL_SQ
-		          , REG_NO
-		          , REG_DT
-		         ) VALUES (
-		            #{custNo}
-		          , #{goodsCd}
-		          , #{afLinkCd}
-		          , #{ithrCd}
-		          , #{contentsLoc}
-		          , #{planDtlSq}
-		          , #{regNo}
-		          , NOW()
-		         )
+		INSERT INTO TB_WISHLIST (
+		       CUST_NO
+		     , GOODS_CD
+		     , AF_LINK_CD
+		     , ITHR_CD
+		     , CONTENTS_LOC
+		     , PLAN_DTL_SQ
+		     , REG_NO
+		     , REG_DT
+		) VALUES (
+		       #{custNo}
+		     , #{goodsCd}
+		     , #{afLinkCd}
+		     , #{ithrCd}
+		     , #{contentsLoc}
+		     , #{planDtlSq}
+		     , #{regNo}
+		     , NOW()
+		)
 		ON DUPLICATE KEY UPDATE
-		         REG_DT = NOW()
+		       REG_DT = NOW()
 	</insert>
 
 	<!-- 위시리스트 삭제 -->
@@ -478,4 +477,25 @@
 		AND    GOODS_CD = #{goodsCd}
 		</if>
 	</delete>
+
+	<!--본인인증처리-->
+	<update id="updateCustomerCi" parameterType="Customer">
+		/* TsfCustomer.updateCustomerCi */
+		UPDATE TB_CUSTOMER
+		SET    CI = #{ci}
+		     , AUTH_DT = NOW()
+		     , UPD_NO = #{updNo}
+		     , UPD_DT = NOW()
+		WHERE  CUST_NO = #{custNo}
+	</update>
+
+	<!--비밀번호 변경 날짜 업데이트-->
+	<update id="updatePasswordDate" parameterType="Customer">
+		UPDATE TB_CUSTOMER
+		SET    PASSWD_CHG_DT = DATE_ADD(NOW(), INTERVAL -#{pwdChangeDay} DAY )
+		     , UPD_NO = #{updNo}
+		     , UPD_DT = NOW()
+		WHERE  CUST_NO = #{custNo}
+	</update>
+
 </mapper>

+ 1 - 0
src/main/webapp/WEB-INF/views/web/SigninFormWeb.html

@@ -176,6 +176,7 @@
 								cfnGoToPage(_PAGE_CUSTOMER_CERTIFICATION);
 							}
 						});
+						return;
 					}
 
 					if (!gagajf.isNull(result.message)) {

+ 80 - 0
src/main/webapp/WEB-INF/views/web/customer/CertificationFormWeb.html

@@ -0,0 +1,80 @@
+<!DOCTYPE html>
+<html lang="ko"
+	xmlns:th="http://www.thymeleaf.org"
+	xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
+	layout:decorator="web/common/layout/DefaultLayoutWeb">
+<!--
+ *******************************************************************************
+ * @source  : DormantCertifyFormWeb.html
+ * @desc    : 휴면회원 본인인증 Page
+ *============================================================================
+ * STYLE24
+ * Copyright(C) 2021 TSIT, All rights reserved.
+ *============================================================================
+ * VER  DATE         AUTHOR      DESCRIPTION
+ * ===  ===========  ==========  =============================================
+ * 1.0  2021.02.05   jsshin     최초 작성
+ *******************************************************************************
+ -->
+<body>
+
+<th:block layout:fragment="content">
+<div id="container" class="container mb">
+	<div class="wrap">
+		<div class="content dormant"> <!-- 페이지특정 클래스 = dormant -->
+			<div class="cont_head">
+				<h4>본인인증</h4>
+			</div>
+			<div class="cont_body">
+				<form class="form_wrap form_col_c form_full" role="form">
+					<div class="form_info">
+						<span class="ico_content_dormant"></span>
+						<p class="c_primary">본인인증이 필요한 고객이므로 본인인증 해주시기 바랍니다.</p>
+					</div>
+					<div class="btn_group_block">
+						<div class="ui_row">
+							<div class="ui_col_12">
+								<button type="button" class="btn btn_default btn_block" onclick="cfnOpenCellphoneCertify();">
+									<span><i class="ico ico_phone"></i>휴대폰인증</span>
+								</button>
+							</div>
+						</div>
+					</div>
+				</form>
+			</div>
+		</div>
+	</div>
+</div>
+
+<script th:inline="javascript">
+/*<![CDATA[*/
+	// 나이스 본인인증 후 콜백
+	var fnNiceCallBack = function(encData) {
+		if (!gagajf.isNull(encData)) {
+			let custInfo = {};
+			custInfo.encData = encData;
+			let jsonData = JSON.stringify(custInfo);
+			gagajf.ajaxJsonSubmit('/customer/certification/save', jsonData, fnCertificationCallback);
+		}
+	};
+
+	var fnCertificationCallback = function (result) {
+		if (result.isSuccess) { //인증 성공시 다시 로그인 페이지
+			mcxDialog.alertC("본인인증 완료 되었습니다.", {
+				sureBtnText: "확인",
+				sureBtnClick: function() {
+					cfnGoToPage(_PAGE_MAIN);
+				}
+			});
+			return;
+		} else { // 이미 가입된 이력이 있는 경우 완료 페이지
+			cfnGoToPage(_PAGE_CUSTOMER_JOIN_COMPLETE);
+		}
+	}
+/*]]>*/
+</script>
+
+</th:block>
+
+</body>
+</html>

+ 3 - 3
src/main/webapp/WEB-INF/views/web/customer/DormantCertifyFormWeb.html

@@ -74,9 +74,9 @@
 		if (result.isRelase) {
 			cfnGoToPage(_PAGE_CUSTOMER_DORMANT_COMPLETE);
 		} else {
-			let msg = "휴면해제 실패하였습니다. <br> 고객센터에 문의 하시기 바랍니다.";
-			if (!gagajf.isNull(result.resultMsg)) {
-				msg = result.resultMsg;
+			let msg = "휴면 해제 실패하였습니다. <br> 고객센터에 문의하시기 바랍니다.";
+			if (result.errorType === 'DIFFERENT_CI') {
+				msg = "등록된 본인인증 정보와 다릅니다. <br> 고객센터에 문의하시기 바랍니다.";
 			}
 			mcxDialog.alert(msg);
 			return;

+ 80 - 0
src/main/webapp/WEB-INF/views/web/customer/PasswordCampaignFormWeb.html

@@ -0,0 +1,80 @@
+<!DOCTYPE html>
+<html lang="ko"
+	xmlns:th="http://www.thymeleaf.org"
+	xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
+	layout:decorator="web/common/layout/DefaultLayoutWeb">
+<!--
+ *******************************************************************************
+ * @source  : PasswordCampaignFormWeb.html
+ * @desc    : 비밀번호 캠페인 화면 Page
+ *============================================================================
+ * STYLE24
+ * Copyright(C) 2021 TSIT, All rights reserved.
+ *============================================================================
+ * VER  DATE         AUTHOR      DESCRIPTION
+ * ===  ===========  ==========  =============================================
+ * 1.0  2021.03.11   jsshin     최초 작성
+ *******************************************************************************
+ -->
+<body>
+
+<th:block layout:fragment="content">
+<div id="container" class="container mb">
+	<div class="wrap">
+		<div class="content campaign"> <!-- 페이지특정 클래스 = campaign -->
+			<div class="cont_head">
+				<h4>비밀번호 변경 캠페인</h4>
+			</div>
+			<div class="cont_body">
+				<form class="form_wrap form_col_c" role="form">
+					<div class="form_info">
+						<span class="ico_content_security"></span>
+						<p class="">고객님! <span class="c_primary">비밀번호 변경</span>으로 <br>소중한 개인정보를 지켜주세요!</p>
+						<p class="c_primary mt5">고객님은 3개월동안 비밀번호를 변경하지 않으셨습니다!</p>
+					</div>
+					<div class="form_summary t_c">
+						<p class="t_info mt10">장기간 비밀번호를 변경하지 않고 동일한 비밀번호를 사용중인 경우,
+							<br> 개인정보를 안전하게 보호하고, 개인정보 도용으로 인한 피해를 방지하기 위해
+							<br>주기적으로 비밀번호를 변경하도록 안내해드리고 있습니다.
+						</p>
+						<p class="t_info mt10">고객님의 소중한 정보 보호를 위해 적극적인 참여 부탁 드립니다.</p>
+					</div>
+					<div class="btn_group_block btn_group_md ui_row">
+						<div class="ui_col_6">
+							<button type="button" class="btn btn_primary btn_block" onclick="cfnGoToPage(_PAGE_CUSTOMER_PWD_CHANGE_TEMP)">
+								<span>변경하기</span>
+							</button>
+						</div>
+						<div class="ui_col_6">
+							<button type="button" class="btn btn_dark btn_block" id="btnPwdNext">
+								<span>30일간 보지않기</span>
+							</button>
+						</div>
+					</div>
+				</form>
+			</div>
+		</div>
+	</div>
+</div>
+
+
+<script th:inline="javascript">
+/*<![CDATA[*/
+
+	// 30일간 보지 않기
+	$('#btnPwdNext').on('click', function () {
+		let jsonData = JSON.stringify({});
+		gagajf.ajaxJsonSubmit('/customer/password/date/update', jsonData, fnPwdDateUpdateCallback);
+	});
+
+	var fnPwdDateUpdateCallback = function (result) {
+		cfnGoToPage(_PAGE_MAIN);
+	}
+
+/*]]>*/
+</script>
+
+</th:block>
+
+</body>
+</html>

+ 10 - 3
src/main/webapp/WEB-INF/views/web/customer/PasswordChangeFormWeb.html

@@ -23,7 +23,8 @@
 	<div class="wrap">
 		<div class="content find">
 			<div class="cont_head">
-				<h4>아이디&#47;비밀번호 찾기</h4>
+				<h4 th:if="${pageGb == 'find'}">아이디&#47;비밀번호 찾기</h4>
+				<h4 th:if="${pageGb == 'temp'}">비밀번호 변경</h4>
 			</div>
 			<div class="cont_body show">
 				<form id="resetPasswordForm" name="resetPasswordForm" class="form_wrap form_col_c" role="form" method="post">
@@ -89,7 +90,8 @@
 						<div class="btn_group_block btn_group_md ui_row">
 							<div class="ui_col_12">
 								<button type="button" id="btnSavePassword" class="btn btn_dark btn_block" disabled="disabled">
-									<span>변경 후 다시 로그인</span>
+									<span th:if="${pageGb == 'find'}">변경 후 다시 로그인</span>
+									<span th:if="${pageGb == 'temp'}">변경하기</span>
 								</button>
 							</div>
 						</div>
@@ -104,6 +106,7 @@
 <script th:src="@{'/biz/customer.js?v=' + ${#calendars.format(#calendars.createNow(), 'yyyyMMddHHmmss')}}" src="/biz/customer.js"></script>
 <script th:inline="javascript">
 /*<![CDATA[*/
+	const pageGb = [[${pageGb}]];
 
 	// 비밀번호 입력
 	$('#resetPasswordForm input[name=passwd]').on('focusout keyup keydown', function () {
@@ -226,7 +229,11 @@
 		mcxDialog.alertC('비밀번호 변경이 완료 되었습니다.', {
 			sureBtnText: "확인",
 			sureBtnClick: function() {
-				cfnGoToPage(_PAGE_LOGIN);
+				if (pageGb === 'find') {
+					cfnGoToPage(_PAGE_LOGIN);
+				} else if (pageGb === 'temp') {
+					cfnGoToPage(_PAGE_MAIN);
+				}
 			}
 		});
 		} else {