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

SNS 탈퇴회원 로그인시 관련 수정 및 비밀번호 없는 SNS회원 초기화 화면 이동

jsshin 4 лет назад
Родитель
Сommit
e0dce1a332

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

@@ -5,10 +5,8 @@ import javax.servlet.http.HttpSession;
 
 import com.style24.core.biz.service.TscMailService;
 import com.style24.front.biz.service.TsfCommonService;
-import com.style24.front.biz.service.TsfCouponService;
 import com.style24.persistence.TscPageRequest;
 import com.style24.persistence.domain.Clause;
-import com.style24.persistence.domain.Coupon;
 import com.style24.persistence.domain.SupplyCompany;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -23,7 +21,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
 
 import com.style24.core.biz.service.TscClauseService;
-import com.style24.core.biz.service.TscKakaotalkService;
 import com.style24.core.support.env.TscConstants;
 import com.style24.core.support.message.TscMessageByLocale;
 import com.style24.front.biz.service.TsfCustomerService;
@@ -59,9 +56,6 @@ public class TsfCustomerController extends TsfBaseController {
 	@Autowired
 	private TscClauseService clauseService;
 
-	@Autowired
-	private TscKakaotalkService kakaotalkService;
-
 	@Autowired
 	private TscMailService mailService;
 
@@ -580,7 +574,7 @@ public class TsfCustomerController extends TsfBaseController {
 
 		GagaMap authInfo = niceCertify.getCertifyCellPhoneResultInfo(customer);
 		if (StringUtils.isNotBlank(customer.getCi())) {
-			log.info("ci ====> {}, sCi ======> {}", customer.getCi(), authInfo.getString("sCi"));
+			//log.info("ci ====> {}, sCi ======> {}", customer.getCi(), authInfo.getString("sCi"));
 			if (!customer.getCi().equals(authInfo.getString("sCi"))) {
 				throw new IllegalStateException("SNS 연계정보와 본인인증 연계정보가 다릅니다.");
 			}

+ 5 - 0
src/main/java/com/style24/front/biz/web/TsfMypageController.java

@@ -2204,6 +2204,11 @@ public class TsfMypageController extends TsfBaseController {
 
 		mav.addObject("custNm", customer.getCustNm());
 
+		if (StringUtils.isNotBlank(customer.getSnsType()) && StringUtils.isBlank(customer.getPasswd())) {
+			mav.setViewName("redirect:/mypage/customer/confirm/form");
+			return mav;
+		}
+
 		mav.setViewName(super.getDeviceViewName("mypage/MypageCustSecedeForm"));
 
 		return mav;

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

@@ -101,21 +101,21 @@ 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())) { // 휴면회원
-
+		// 휴면회원
+		if (TscConstants.CustStat.DORMANT.value().equals(loginInfo.getCustStat())) {
 			// 휴면해제를 위한 고객번호 세션저장
 			TsfSession.setAttribute("custNo", String.valueOf(loginInfo.getCustNo()));
 			throw new TsfDormantAccountException(message.getMessage("LOGN_0006"));
-
-		} else if (TscConstants.CustStat.SECEDE.value().equals(loginInfo.getCustStat())) { // 탈퇴회원
+		}
+		// 탈퇴회원
+		if (TscConstants.CustStat.SECEDE.value().equals(loginInfo.getCustStat())) {
 			throw new TsfSecedeAccountException(message.getMessage("LOGN_0007"));
 		}
+		// 활동회원 중 본인인증이 필요한 회원
+		if (TscConstants.CustStat.ACTIVE.value().equals(loginInfo.getCustStat()) && StringUtils.isBlank(loginInfo.getCi())) {
+			TsfSession.setAttribute("custNo", String.valueOf(loginInfo.getCustNo()));
+			throw new TsfNonCertificationAccountException(message.getMessage("LOGN_0009"));
+		}
 
 		// 권한 설정
 		List<SimpleGrantedAuthority> authorities = new ArrayList<>();

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

@@ -6,8 +6,13 @@ import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.gagaframework.web.parameter.GagaParameterUtil;
+import com.gagaframework.web.rest.client.GagaRequest;
+import com.gagaframework.web.rest.server.GagaResponse;
+import com.style24.front.support.env.TsfConstants;
 import com.style24.front.support.exception.TsfNonCertificationAccountException;
 import com.style24.persistence.domain.Login;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.core.AuthenticationException;
 import org.springframework.security.web.authentication.AuthenticationFailureHandler;
@@ -44,7 +49,13 @@ public class TsfLoginFailureHandler implements AuthenticationFailureHandler {
 		AuthenticationException exception) throws IOException, ServletException {
 
 		// 로그인 실패 남기기
-		loginService.createLoginFail(request.getParameter("loginId"), "Y");
+		String loginId;
+		if (StringUtils.isNotBlank(request.getParameter("loginId"))) {
+			loginId = request.getParameter("loginId");
+		} else {
+			loginId = request.getParameter("snsType") +"_" + GagaStringUtil.replace(request.getParameter("snsId"), TsfConstants.SNSLOGIN_PREFIX, "");
+		}
+		loginService.createLoginFail(loginId, "Y");
 
 		GagaMap result = new GagaMap();
 		result.setString("message", exception.getMessage());
@@ -65,11 +76,11 @@ public class TsfLoginFailureHandler implements AuthenticationFailureHandler {
 			result.setString("status", "ETC_ERROR");
 		}
 
-		Login loginFailInfo = loginService.getLoginFailInfo(request.getParameter("loginId"));
+		Login loginFailInfo = loginService.getLoginFailInfo(loginId);
 
 		// 실패 횟수 10회 이상이면서 3분 지난경우 초기화 해준다.
 		if (loginFailInfo.getLoginFailCnt() >= 10 && loginFailInfo.getBlockSecs() <= 0) {
-			loginService.updateLoginFailInfo(request.getParameter("loginId"));
+			loginService.updateLoginFailInfo(loginId);
 		}
 		// 로그인실패정보 조회
 		result.set("loginFailInfo", loginFailInfo);