수정페이지 ,연동해제, 비밀번호초기화 폰번호없이(변경?) 통합탈퇴(진행중)

This commit is contained in:
JSYOO 2021-09-09 17:11:16 +09:00
parent 215a8df9c2
commit 909da9c532
12 changed files with 178 additions and 39 deletions

View File

@ -63,5 +63,7 @@ public interface MemberService
public int selectSnsIdCount(OAuthUniversalUser oauthUser);
public void deleteMembership(NlibLoginVO loginVO) throws Exception;;
}

View File

@ -47,4 +47,6 @@ public interface MemberDAO
public int selectMemberSiteCount(MemberSiteVO msVO);
public int selectSnsIdCount(OAuthUniversalUser oauthUser);
public void deleteMembership(NlibLoginVO loginVO) throws Exception;
}

View File

@ -239,4 +239,8 @@ public class MemberServiceImpl implements MemberService
return memberDAO.selectSnsIdCount(oauthUser);
}
public void deleteMembership(NlibLoginVO loginVO) throws Exception {
memberDAO.deleteMembership(loginVO);
}
}

View File

@ -289,33 +289,33 @@ public class MemberController extends NlibCommonController{
return "nlib/member/insertMemberInfoForm";
}
/**
* 동일한 핸드폰번호로 가입한 계정있을 통합팝업
* @exception Exception
*/
@RequestMapping(value="/member/selectAlreadySignUpMobile.do")
public String selectAlreadySignUpMobile(NlibLoginVO vo,ModelMap model,HttpSession session,HttpServletRequest request) throws Exception{
List<NlibLoginVO> voList = new ArrayList<NlibLoginVO>();
// 등록된 전화번호가 있는 확인 (리스트)
voList = memberService.selectAlreadySignUpMobile(vo);
//통합처리 url
model.addAttribute("cnt",voList.size());
model.addAttribute("result",voList);
return "nlib/member/alreadySignUp";
}
/**
* 회원가입
* @exception Exception
*/
@RequestMapping(value="/member/insertMemberInfo.do")
public String insertMemberInfo(NlibLoginVO vo,ModelMap model,HttpSession session) throws Exception{
public String insertMemberInfo(NlibLoginVO vo,ModelMap model,HttpSession session,HttpServletRequest request) throws Exception{
MemberSiteVO msVO= new MemberSiteVO();
List<NlibLoginVO> voList = new ArrayList<NlibLoginVO>();
EmailVO email = new EmailVO();
//문화원코드
String councilCd = (String)session.getAttribute("councilCd");
// 등록된 전화번호가 있는 확인 (리스트)
voList = memberService.selectAlreadySignUpMobile(vo);
/* 등록된 ID가 있을때 통합처리 */
if(voList.size() > 0)
{
//통합처리 url
model.addAttribute("result",voList);
return "nlib/member/accountConsolidationForm";
}
String jsessionId = session.getId();
OAuthUniversalUser oauthUser = SessionConfig.popNewMemberInfo(jsessionId);
if(oauthUser.getNlibVO()!=null)
{
//핸드폰인증시 sns제공 번호와 회원가입폼 번호 비교
@ -343,8 +343,10 @@ public class MemberController extends NlibCommonController{
}
}
}
//회원정보 insert
//문화원코드
String councilCd = (String)session.getAttribute("councilCd");
//회원정보 insert
NlibLoginVO result =memberService.insertMemberInfo(vo);
//sns 테이블 insert
@ -563,11 +565,47 @@ public class MemberController extends NlibCommonController{
public String deleteMembershipForm(HttpServletResponse response,Authentication authentication,HttpServletRequest request,ModelMap model) throws Exception{
//사용자 정보를 가져온다.
NlibLoginVO loginVO = getNlibLoginVO(authentication);
loginVO.decodePrivateInfo();
//이메일 마스킹
loginVO.setLoginUserId(maskingEmail(loginVO.getLoginUserId()));
model.addAttribute("loginVO",loginVO);
return "nlib/member/deleteMembershipForm";
}
/**
* 회원탈퇴
* @exception Exception
*/
@RequestMapping(value="/member/deleteMembership.ajax")
public @ResponseBody String deleteMembership(Authentication authentication,HttpServletResponse response,HttpServletRequest request,ModelMap model) throws Exception{
//사용자 정보를 가져온다.
NlibLoginVO loginVO = getNlibLoginVO(authentication);
loginVO.setJoinCouncilCd(getCurCouncilCd(request));
loginVO = loginService.selectLoginUserInfo(loginVO);
String password=egovPasswordEncoder.encryptPassword(loginVO.getLoginUserId()+request.getParameter("password"));
String message="";
if(loginVO!=null && (loginVO.getPassword().equals(password)))
{
//회원탈퇴
memberService.deleteMembership(loginVO);
OAuthUniversalUser oAuthVO = new OAuthUniversalUser();
oAuthVO.setMbInfoId(loginVO.getMbInfoId());
//sns 연동해제
userInfoService.deleteSnsLink(oAuthVO);
message="delete";
}else {
message="mismatch";
}
return message;
}
/**
* 비밀번호초기화
* @exception Exception

View File

@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import egovframework.com.ext.oauth.service.OAuthUniversalUser;
import egovframework.rte.fdl.cryptography.EgovPasswordEncoder;
import nlib.restful.service.DataApiReqVO;
import nlib.security.SecUserDetailsService;
import nlib.security.SecUserVO;
import nlib.user.service.LoginService;
import nlib.user.service.MemberService;
@ -66,6 +67,10 @@ public class UserInfoController extends NlibCommonController {
@Resource(name = "egovEnvPasswordEncoderService")
EgovPasswordEncoder egovPasswordEncoder;
@Resource(name = "userDetailsService")
private SecUserDetailsService SecUserDetailsService;
/**
* 정보 조회
* @exception Exception
@ -126,7 +131,13 @@ public class UserInfoController extends NlibCommonController {
encodedText = egovPasswordEncoder.encryptPassword(vo.getPassword());
vo.setPassword(encodedText);
// 정보 수정
userInfoService.updateMyInfo(vo);
NlibLoginVO loginVO=(NlibLoginVO) SecUserDetailsService.loadUserByUsername(vo.getLoginUserId());
//세션에 수정정보로 주입
replaceNlibLoginVO(request,loginVO);
}
/**

View File

@ -207,4 +207,24 @@
AND UNLINK_DD IS NULL
</select>
<!-- 회원 탈퇴 -->
<update id="deleteMembership" parameterType="nlib.user.service.NlibLoginVO">
/* deleteMembership */
UPDATE
MB_INFO
SET
LEAVE_SITE_DATE = DATE_FORMAT(CURDATE(), '%Y%m%d')
,STATUS = "D"
,MOBILE_NO = NULL
,BIRTHDAY = NULL
,ZIP_CODE = NULL
,ADDRESS = NULL
,ADDRESS_DETAIL = NULL
,GENDER = NULL
,EMAIL = NULL
,PASSWORD = NULL
WHERE 1=1
AND MB_INFO_ID = #{mbInfoId}
</update>
</mapper>

View File

@ -36,12 +36,6 @@
</head>
<body>
<h1>계정이 통합되었습니다.</h1>
<c:forEach items="${result}" var="result">
<tr>
<td><c:out value="${result.mbInfoId}"/></td>
<td><c:out value="${result.loginUserId}"/></td>
</tr>
</c:forEach>
</body>
</html>

View File

@ -0,0 +1,40 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script>
function notAlreadySingUp()
{
window.close();
}
$(document).ready(function(){
if(${cnt} > 0) {
fn_showLayerPop();
} else {
window.close();
}
});
</script>
</head>
<body>
<form id="alreadySingUpForm" name="alreadySingUpForm" action="${pageContext.request.contextPath}/member/insertMemberInfo.do">
<p1>서비스에 이미 가입된 계정이 있습니다.</p1>
<table>
<c:forEach items="${result}" var="result">
<tr>
<td><c:out value="${result.mbInfoId}"/></td>
<td><c:out value="${result.loginUserId}"/></td>
</tr>
</c:forEach>
</table>
<a onclick="notAlreadySingUp();">아니요, 내가 아닙니다.</a>
</form>
</body>
</html>

View File

@ -32,6 +32,30 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script>
function deleteMembership()
{
$.ajax({
url : "${pageContext.request.contextPath}/member/deleteMembership.ajax",
type : "POST",
async: false,
data : {password:$("#password").val()},
success : function(result){
if(result=="delete")
{
alert("탈퇴처리 되었습니다.감사합니다.");
location.href="${pageContext.request.contextPath}/index.do"
}else if(result=="mismatch")
{
alert("비밀번호가 일치하지 않습니다.다시 확인해주세요.");
}
},error : function(){
}
})
}
</script>
</head>
<body>
<form id="deleteMembershipForm" name="deleteMembershipForm">
@ -39,7 +63,7 @@
이름 : <c:out value="${loginVO.name }"/><br>
이메일 : <c:out value="${loginVO.loginUserId }"/><br>
<input type="password" id="password" name="password" placeholder="비밀번호"><br>
<input type="button" value="탈퇴하기"><input type="button" onclick="location.href='${pageContext.request.contextPath}/userInfo/putMyInfo.do'" value="취소">
<input type="button" onclick="deleteMembership();" value="탈퇴하기"><input type="button" onclick="location.href='${pageContext.request.contextPath}/userInfo/putMyInfo.do'" value="취소">
</form>
</body>
</html>

View File

@ -75,6 +75,7 @@ function signUp(){
//연락받을 이메일 입력
%>
$("#email").val($("#loginUserId").val());
document.joinForm.action="/nlib/member/insertMemberInfo.do";
return true;
}else{
return false;
@ -245,6 +246,8 @@ function certMobileCheck(){
{
alert("인증되었습니다.");
$("#mobileCertYn").val("Y");
document.joinForm.action="/nlib/member/selectAlreadySignUpMobile.do";
fn_layerPopFormSubmit(document.joinForm,false);
}else
{
alert("인증번호가 일치하지않습니다.");
@ -421,7 +424,7 @@ label.error {
<b><font size="6" color="gray">회원가입</font></b>
<br><br><br>
<form id="joinForm" name="joinForm" action="/nlib/member/insertMemberInfo.do" method="post" onsubmit="return signUp()">
<form id="joinForm" name="joinForm" method="post" onsubmit="return signUp()">
<table>
<tr>
<td id="title">아이디</td>

View File

@ -38,26 +38,20 @@
<title>Insert title here</title>
<script>
function snsCertForm(){
if(document.getElementsByName('agree')[0].focus())
if(!(document.getElementsByName('agree')[0].checked))
{
alert("이용약관에 동의해주세요.");
document.termsForm.agree[0].focus()
return false;
}
if(document.getElementsByName('agree')[1].focus())
if(!(document.getElementsByName('agree')[1].checked))
{
alert("개인정보처리정책에 동의해주세요.");
document.termsForm.agree[1].focus()
return false;
}
if(document.getElementById('agree').checked)
{
location.href="${pageContext.request.contextPath}/member/insertMemberInfoForm.do";
}
else{
alert("약관에 동의해주세요");
}
}
</script>
</head>
<body>

View File

@ -105,17 +105,24 @@ function fn_layerPop(url) {
$("#NLIB_LAYER_POPUP").show();
}
function fn_layerPopFormSubmit(formName) {
function fn_showLayerPop() {
$("#NLIB_LAYER_POPUP").show();
}
function fn_layerPopFormSubmit(formName, display) {
var dataList = $("#" + formName).serialize();
var url = $("#" + formName).attr('action');
$("#NLIB_LAYER_POPUP").show();
if(display) $("#NLIB_LAYER_POPUP").show();
else $("#NLIB_LAYER_POPUP").hide();
$.ajax({
type: "post",
url: url,
data: dataList
}).done(function(response){
$("#" + formName).html(response);
$("#NLIB_LAYER_POPUP").html(response);
});
}
// 콜백