jsshin před 5 roky
rodič
revize
3c22725d50

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

@@ -77,7 +77,7 @@ public class TsfCustomerService {
 	}
 
 	/**
-	 * 고객정보찾기 -
+	 * 고객정보찾기
 	 *
 	 * @param custNo - 고객번호
 	 * @return Customer 고객정보
@@ -93,6 +93,23 @@ public class TsfCustomerService {
 		return coreCustomerService.getCustomerInfo(customer);
 	}
 
+	/**
+	 * 휴면고객 정보 찾기
+	 *
+	 * @param custNo - 고객번호
+	 * @return Customer 고객정보
+	 * @author jsshin
+	 * @since 2021. 03. 10
+	 */
+	public Customer getDormantCustomerFindByCustNo(Integer custNo) {
+		Customer customer = new Customer();
+		customer.setCustNo(custNo);
+		customer.setCustStat(TscConstants.CustStat.DORMANT.value());
+		customer.setSiteCd(TscConstants.Site.STYLE24.value());
+		customer.encryptData();
+		return coreCustomerService.getCustomerInfo(customer);
+	}
+
 
 	/**
 	 * 임시비밀번호 조회
@@ -663,6 +680,14 @@ public class TsfCustomerService {
 	 */
 	public GagaMap releaseDormantCustomer(Customer customer) {
 		GagaMap result = new GagaMap();
+
+		Customer custInfo = getDormantCustomerFindByCustNo(customer.getCustNo());
+
+		if (!customer.getCi().equals(custInfo.getCi())) {
+			result.setBoolean("isRelase", false);
+			result.setString("resultMsg","본인인증이 동일하지 않습니다.");
+			return result;
+		}
 		customer.setRegNo(customer.getCustNo());
 		customer.setUpdNo(customer.getCustNo());
 		boolean isRelase = coreCustomerService.saveDormantCustomerRelease(customer);

+ 23 - 1
src/main/java/com/style24/front/biz/web/TsfCustomerController.java

@@ -692,14 +692,18 @@ public class TsfCustomerController extends TsfBaseController {
 		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));
+
 		return customerService.releaseDormantCustomer(customer);
 	}
 
 	/**
 	 * 휴면해제 완료화면
 	 *
-	 * @return ModelAndView - 가입완료 화면
+	 * @return ModelAndView - 휴면해제 완료화면
 	 * @author jsshin
 	 * @since 2021. 03. 08
 	 */
@@ -712,7 +716,25 @@ public class TsfCustomerController extends TsfBaseController {
 		return mav;
 	}
 
+	/**
+	 * 본인인증 화면
+	 *
+	 * @return ModelAndView - 가입완료 화면
+	 * @author jsshin
+	 * @since 2021. 03. 08
+	 */
+	@GetMapping("/certification/form")
+	public ModelAndView getCertificationForm() {
+		ModelAndView mav = new ModelAndView();
+
+		mav.setViewName(super.getDeviceViewName("customer/CertificationForm"));
 
+		return mav;
+	}
 
+	@PostMapping("/certification/save")
+	public GagaMap saveCertification(Customer customer) {
+		return  null;
+	}
 
 }

+ 22 - 0
src/main/java/com/style24/front/support/exception/TsfNonCertificationAccountException.java

@@ -0,0 +1,22 @@
+package com.style24.front.support.exception;
+
+import org.springframework.security.core.AuthenticationException;
+
+/**
+ * 비인증 고객 로그인시 발생하는 예외
+ *
+ * @author jsshin
+ * @since 2021. 03. 10
+ */
+@SuppressWarnings("serial")
+public class TsfNonCertificationAccountException extends AuthenticationException {
+
+	public TsfNonCertificationAccountException(String msg) {
+		super(msg);
+	}
+
+	public TsfNonCertificationAccountException(String msg, Throwable t) {
+		super(msg, t);
+	}
+
+}

+ 16 - 2
src/main/java/com/style24/front/support/security/TsfAuthenticationProvider.java

@@ -3,8 +3,11 @@ package com.style24.front.support.security;
 import java.util.ArrayList;
 import java.util.List;
 
+import com.gagaframework.web.util.GagaCookieUtil;
+import com.style24.front.support.exception.TsfNonCertificationAccountException;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.security.authentication.AuthenticationProvider;
 import org.springframework.security.authentication.BadCredentialsException;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@@ -49,6 +52,11 @@ public class TsfAuthenticationProvider implements AuthenticationProvider {
 	@Autowired
 	private GagaPasswordEncoder passwordEncoder;
 
+	@Value("${has-ssl}")
+	private String hasSsl;
+
+	private static final int LOGIN_FAIL_COUNT = 5; // 실패누적건수
+
 	@Override
 	public Authentication authenticate(Authentication authentication) throws AuthenticationException {
 		String loginId = authentication.getName();
@@ -78,7 +86,7 @@ public class TsfAuthenticationProvider implements AuthenticationProvider {
 		}
 
 		// 로그인 실패누적건수가 5회 이상이면
-		if (loginInfo.getLoginFailCnt() >= 5) {
+		if (loginInfo.getLoginFailCnt() >= LOGIN_FAIL_COUNT) {
 			throw new TsfLockedAccountException(message.getMessage("LOGN_0005"));
 		}
 
@@ -93,9 +101,15 @@ public class TsfAuthenticationProvider implements AuthenticationProvider {
 			}
 		}
 
+		// 본인인증이 필요한 회원
+		if (StringUtils.isBlank(loginInfo.getCi())) {
+			TsfSession.setAttribute("custNo", String.valueOf(loginInfo.getCustNo()));
+			throw new TsfNonCertificationAccountException(message.getMessage("LOGN_0009"));
+		}
+
 		if (TscConstants.CustStat.DORMANT.value().equals(loginInfo.getCustStat())) { // 휴면회원
 
-			// 휴면해제를 위한 고객번호 세선저장
+			// 휴면해제를 위한 고객번호 세저장
 			TsfSession.setAttribute("custNo", String.valueOf(loginInfo.getCustNo()));
 			throw new TsfDormantAccountException(message.getMessage("LOGN_0006"));
 

+ 3 - 0
src/main/java/com/style24/front/support/security/handler/TsfLoginFailureHandler.java

@@ -6,6 +6,7 @@ import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.style24.front.support.exception.TsfNonCertificationAccountException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.core.AuthenticationException;
 import org.springframework.security.web.authentication.AuthenticationFailureHandler;
@@ -57,6 +58,8 @@ public class TsfLoginFailureHandler implements AuthenticationFailureHandler {
 			result.setString("status", "SESSION_EXPIRED");
 		} else if (exception instanceof TsfEmailDuplicationException) { // SNS용 이메일 중복 시
 			result.setString("status", "EMAIL_DUP");
+		} else if (exception instanceof TsfNonCertificationAccountException){ //본인인증 필요한 회원
+			result.setString("status","CI_EMPTY");
 		} else {
 			result.setString("status", "ETC_ERROR");
 		}

+ 13 - 0
src/main/java/com/style24/front/support/security/handler/TsfLoginSuccessHandler.java

@@ -47,6 +47,9 @@ public class TsfLoginSuccessHandler implements AuthenticationSuccessHandler {
 		"/customer/join/type/form",					// 회원가입유형
 		"/customer/dormant/certify/complete/form"	// 휴면해제
 	};
+	private static final int CHANG_PWD_CAMPAIGN_DAY = 90; // 비밀번호 변경 캠페인일자
+
+	private static final String CHANG_TEMP_PWD = "Y";	//임시비밀번호여부
 
 	@Autowired
 	private TsfLoginService loginService;
@@ -112,6 +115,16 @@ public class TsfLoginSuccessHandler implements AuthenticationSuccessHandler {
 		// 로그인 후 장바구니 Update
 		cartService.updateCartToAfterLogin(custNo);
 
+		// 비밀번호 변경 캠페인 일자
+		if (loginDetails.getLoginInfo().getPwdChgDay() > CHANG_PWD_CAMPAIGN_DAY) {
+			returnUrl ="";
+		}
+		// 임시비밀번호로 로그인 한 경우
+		if (CHANG_TEMP_PWD.equals(loginDetails.getLoginInfo().getTempPasswdYn())) {
+			returnUrl ="";
+		}
+
+
 		GagaMap result = new GagaMap();
 		result.setString("status", "OK");
 		result.setString("returnUrl", returnUrl);

+ 4 - 1
src/main/java/com/style24/persistence/domain/Login.java

@@ -9,7 +9,7 @@ import lombok.Data;
 
 /**
  * 고객 Domain
- * 		@JsonSerialize 애노테이션을 지정해야 세션을 레디스에 저장할 수 있다.
+ * @JsonSerialize 애노테이션을 지정해야 세션을 레디스에 저장할 수 있다.
  * @author gagamel
  * @since 2019. 12. 4
  */
@@ -43,6 +43,9 @@ public class Login extends TscBaseDomain {
 	private String loginLdt;		// 최종로그인일시
 	private String loginFailYn;		// 로그인실패여부
 	private String custGrade;		// 고객등급
+	private String tempPasswdYn;	// 임시비밀번호여부
+	private int pwdChgDay;			// 비밀번호변경일자
+	private String ci;				// CI(본인인증여부)
 
 	// 암호화 대상 복호화 처리 =================================================
 	public String getCustNm() {

+ 20 - 17
src/main/java/com/style24/persistence/mybatis/shop/TsfLogin.xml

@@ -5,33 +5,36 @@
 	<!-- 로그인체크 정보 조회 -->
 	<select id="getLoginCheckInfo" parameterType="Login" resultType="Login">
 		/* TsfLogin.getLoginCheckInfo */
-		SELECT CUST_NO                                          /*고객번호*/
-		     , CUST_ID                                          /*고객ID*/
-		     , CUST_NM                                          /*고객명*/
-		     , PASSWD                                           /*비밀번호*/
-		     , CUST_GB                                          /*고객구분*/
-		     , FN_GET_CODE_NM('G100',CUST_GB) AS CUST_GB_NM     /*고객구분명*/
-		     , CUST_STAT                                        /*회원상태*/
-		     , CELL_PHNNO                                       /*휴대전화번호*/
-		     , EMAIL                                            /*이메일*/
-		     , #{snsType}                     AS SNS_TYPE       /*SNS유형*/
-		     , #{snsId}                       AS SNS_ID         /*SNS가입ID*/
+		SELECT CUST_NO                                                 /*고객번호*/
+		     , CUST_ID                                                 /*고객ID*/
+		     , CUST_NM                                                 /*고객명*/
+		     , PASSWD                                                  /*비밀번호*/
+		     , CUST_GB                                                 /*고객구분*/
+		     , FN_GET_CODE_NM('G100',CUST_GB) AS CUST_GB_NM            /*고객구분명*/
+		     , CUST_STAT                                               /*회원상태*/
+		     , CELL_PHNNO                                              /*휴대전화번호*/
+		     , EMAIL                                                   /*이메일*/
+		     , #{snsType}                     AS SNS_TYPE              /*SNS유형*/
+		     , #{snsId}                       AS SNS_ID                /*SNS가입ID*/
 		     , IFNULL((SELECT LOGIN_FAIL_CNT
 		               FROM   TB_LOGIN_FAIL
 		               WHERE  CUST_ID = #{custId}
 		               AND    IP_ADDR = #{ipAddr}
 		               AND    SITE_CD = #{siteCd}
-		              ),0)                    AS LOGIN_FAIL_CNT /*로그인실패건수*/
+		              ),0)                    AS LOGIN_FAIL_CNT         /*로그인실패건수*/
+		     , TEMP_PASSWD_YN                                           /*임시비밀번호여부*/
+		     , IFNULL(DATEDIFF(NOW(), PASSWD_CHG_DT), 0) AS PWD_CHG_DAY /*비밀번호변경일자*/
+		     , CI                                                       /*CI본인인증여부*/
 		FROM   TB_CUSTOMER A
 		WHERE  1 = 1
 		<choose>
 		    <when test="snsType != null and snsType != ''"> <!-- SNS 로그인  -->
 		AND    CUST_NO = (
-		               SELECT CUST_NO
-		               FROM TB_CUSTOMER_SNS
-		               WHERE SNS_TYPE = #{snsType}
-		               AND   SNS_ID = #{snsId}
-		               )
+		                  SELECT CUST_NO
+		                  FROM   TB_CUSTOMER_SNS
+		                  WHERE  SNS_TYPE = #{snsType}
+		                  AND    SNS_ID = #{snsId}
+		                 )
 		    </when>
 		    <when test="custNo != null and custNo != ''">
 		AND    CUST_NO = #{custNo}

+ 2 - 0
src/main/resources/i18n/messages/message_ko_KR.properties

@@ -32,6 +32,8 @@ LOGN_0005=\uBE44\uBC00\uBC88\uD638\uAC00 5\uD68C \uC774\uC0C1 \uD2C0\uB824 \uACC
 LOGN_0006=\uD734\uBA74 \uD68C\uC6D0\uC785\uB2C8\uB2E4.
 LOGN_0007=\uD0C8\uD1F4 \uD68C\uC6D0\uC785\uB2C8\uB2E4.
 LOGN_0008=\uC774\uBBF8 \uAC00\uC785\uD558\uC2E0 \uC774\uBA54\uC77C\uC774 \uC874\uC7AC\uD569\uB2C8\uB2E4.
+LOGN_0009=\uBCF8\uC778\uC778\uC99D\uC774 \uD544\uC694\uD55C \uD68C\uC6D0\uC785\uB2C8\uB2E4.
+
 
 ##\uC7A5\uBC14\uAD6C\uB2C8
 CART_0001=\uC7A5\uBC14\uAD6C\uB2C8\uC5D0 \uB2F4\uACBC\uC2B5\uB2C8\uB2E4.

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

@@ -163,12 +163,19 @@
 								cfnGoToPage(_PAGE_CUSTOMER_DORMANT);
 							}
 						});
-
 						return;
 					} else if (result.status == 'SECEDE_CUST') {
 						// 탈퇴회원
 					} else if (result.status == 'SESSION_EXPIRED') {
 						// 세션만료
+					} else if (result.status == 'CI_EMPTY') {
+						// 본인이증 필요한 회원
+						mcxDialog.alertC("본인인증 후 다시 로그인 하시기 바랍니다.", {
+							sureBtnText: "확인",
+							sureBtnClick: function() {
+								cfnGoToPage(_PAGE_CUSTOMER_CERTIFICATION);
+							}
+						});
 					}
 
 					if (!gagajf.isNull(result.message)) {

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

@@ -74,7 +74,11 @@
 		if (result.isRelase) {
 			cfnGoToPage(_PAGE_CUSTOMER_DORMANT_COMPLETE);
 		} else {
-			mcxDialog.alert("휴면해제 실패하였습니다. <br> 고객센터에 문의 하시기 바랍니다.");
+			let msg = "휴면해제 실패하였습니다. <br> 고객센터에 문의 하시기 바랍니다.";
+			if (!gagajf.isNull(result.resultMsg)) {
+				msg = result.resultMsg;
+			}
+			mcxDialog.alert(msg);
 			return;
 		}
 	}

+ 1 - 0
src/main/webapp/ux/style24_link.js

@@ -18,6 +18,7 @@ const _PAGE_CUSTOMER_PWD_CHANGE_FIND = _frontUrl + "/customer/password/change/fo
 const _PAGE_CUSTOMER_PWD_CHANGE_TEMP = _frontUrl + "/customer/password/change/form?pageGb=temp";	// 고객 > 임시비밀번호 로그인 > 비밀번호 변경 화면
 const _PAGE_CUSTOMER_DORMANT = _frontUrl + "/customer/dormant/certify/form";						// 고객 > 휴면회원
 const _PAGE_CUSTOMER_DORMANT_COMPLETE = _frontUrl + "/customer/dormant/certify/complete/form";		// 고객 > 휴면회원 > 완료페이지
+const _PAGE_CUSTOMER_CERTIFICATION = "/customer/certification/form"									// 고객 > 본인인증화면
 
 //== 상품상세 ==/
 const _PAGE_GOODS_DETAIL = _frontUrl + "/goods/detail/form?goodsCd=";								// 상품 상세