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

This commit is contained in:
JSYOO 2021-09-09 11:27:20 +09:00
parent 821363335d
commit b89edcf729
18 changed files with 804 additions and 130 deletions

View File

@ -7,6 +7,7 @@ import nlib.util.StringUtil;
public class OAuthUniversalUser { public class OAuthUniversalUser {
private String mbSnsId;
private String mbInfoId; private String mbInfoId;
private String snsId; private String snsId;
@ -24,6 +25,7 @@ public class OAuthUniversalUser {
private String loginIp; private String loginIp;
private Date lastLogin; private Date lastLogin;
private String regDd;
private NlibLoginVO nlibVO; private NlibLoginVO nlibVO;
private boolean isValidLogin = false; private boolean isValidLogin = false;
@ -160,4 +162,20 @@ public class OAuthUniversalUser {
this.nlibVO = nlibVO; this.nlibVO = nlibVO;
} }
public String getMbSnsId() {
return mbSnsId;
}
public void setMbSnsId(String mbSnsId) {
this.mbSnsId = mbSnsId;
}
public String getRegDd() {
return regDd;
}
public void setRegDd(String regDd) {
this.regDd = regDd;
}
} }

View File

@ -38,4 +38,6 @@ public interface LoginService
public int agreeProvInfo(NlibLoginVO loginVO); public int agreeProvInfo(NlibLoginVO loginVO);
public NlibLoginVO selectLoginUserInfo(NlibLoginVO loginVO);
} }

View File

@ -37,10 +37,10 @@ public class MemberSiteVO implements Serializable {
private String joinType; /* 가입유형 SNS 및 로그인을 연계하는 포털시스템 아이디(naver, daum 등) */ private String joinType; /* 가입유형 SNS 및 로그인을 연계하는 포털시스템 아이디(naver, daum 등) */
private String joinAgreeDd; /* 가입동의일자 */ private String joinAgreeDd; /* 가입동의일자 */
private String joinCouncilCd; /* 가입문화원코드 */ private String joinCouncilCd; /* 가입문화원코드 */
private String joinCouncilNm; /* 가입문화원명 */
private String masterYn; /* 대표여부 */ private String masterYn; /* 대표여부 */
private String ipNotUse; /* 접속아이피 */ private String ipNotUse; /* 접속아이피 */
private String lastAccessDdNotUse; /* 마지막접근일자 */ private String lastAccessDdNotUse; /* 마지막접근일자 */
//---------------------------------------------------------------- //----------------------------------------------------------------
// SETTER.GETTER // SETTER.GETTER
//---------------------------------------------------------------- //----------------------------------------------------------------
@ -92,4 +92,10 @@ public class MemberSiteVO implements Serializable {
public void setLastAccessDdNotUse(String lastAccessDdNotUse) { public void setLastAccessDdNotUse(String lastAccessDdNotUse) {
this.lastAccessDdNotUse = lastAccessDdNotUse; this.lastAccessDdNotUse = lastAccessDdNotUse;
} }
public String getJoinCouncilNm() {
return joinCouncilNm;
}
public void setJoinCouncilNm(String joinCouncilNm) {
this.joinCouncilNm = joinCouncilNm;
}
} }

View File

@ -1,6 +1,9 @@
package nlib.user.service; package nlib.user.service;
import java.util.List;
import egovframework.com.ext.oauth.service.OAuthUniversalUser;
/** /**
* Description : * Description :
@ -21,7 +24,44 @@ package nlib.user.service;
*/ */
public interface UserInfoService public interface UserInfoService
{ {
public NlibLoginVO selectMyInfo(NlibLoginVO vo) throws Exception;
/** 사용자의 SNS 연동 리스트를 조회한다.
* @param vo
* @return
* @throws Exception
*/
public List<OAuthUniversalUser> selectSnsSignUpList(NlibLoginVO vo) throws Exception;
/** 정보를 수정한다.
* @param vo
* @throws Exception
*/
public void updateMyInfo(NlibLoginVO vo) throws Exception; public void updateMyInfo(NlibLoginVO vo) throws Exception;
/** 가입문화원 리스트를 조회한다.
* @param vo
* @return
* @throws Exception
*/
public List<MemberSiteVO> selectCenterSignUpList(NlibLoginVO vo) throws Exception;
/** SNS연동을 해지한다.
* @param oAuthVO
* @throws Exception
*/
public void deleteSnsLink(OAuthUniversalUser oAuthVO) throws Exception;
/** 문화원 가입을 해지한다.
* @param siteVO
* @throws Exception
*/
public void deleteCenterLink(MemberSiteVO siteVO) throws Exception;
/** 사용자의 정보를 조회한다.
* @param vo
* @return
* @throws Exception
*/
public NlibLoginVO selectMyInfo(NlibLoginVO vo) throws Exception;
} }

View File

@ -121,12 +121,18 @@ public class LoginServiceImpl implements LoginService
return ERR_CODE_REQ_MEMBERSHIP; return ERR_CODE_REQ_MEMBERSHIP;
} }
// 휴면계 확인 // 휴면계 확인
if("P".equals(nLoginVO.getStatus())) { if("P".equals(nLoginVO.getStatus())) {
oUser.setNlibVO(nLoginVO); oUser.setNlibVO(nLoginVO);
return WRN_CODE_DORMANT; return WRN_CODE_DORMANT;
} }
// 탈퇴계정 확인
if("D".equals(nLoginVO.getStatus())) {
oUser.setNlibVO(nLoginVO);
return ERR_CODE_REQ_MEMBERSHIP;
}
// 해당 지방문화원에 미등록된 경우, 정보제공 동의로 이동 처리 필요 // 해당 지방문화원에 미등록된 경우, 정보제공 동의로 이동 처리 필요
if(StringUtil.isEmpty(nLoginVO.getJoinCouncilCd())) { if(StringUtil.isEmpty(nLoginVO.getJoinCouncilCd())) {
oUser.setNlibVO(nLoginVO); oUser.setNlibVO(nLoginVO);
@ -216,6 +222,12 @@ public class LoginServiceImpl implements LoginService
public int agreeProvInfo(NlibLoginVO loginVO) { public int agreeProvInfo(NlibLoginVO loginVO) {
return loginDAO.agreeProvInfo(loginVO); return loginDAO.agreeProvInfo(loginVO);
} }
public NlibLoginVO selectLoginUserInfo(NlibLoginVO loginVO) {
return loginDAO.selectLoginUserInfo(loginVO);
}
/* SNS 연동 SSO를 통한 로그인 처리한다. /* SNS 연동 SSO를 통한 로그인 처리한다.
* *

View File

@ -47,12 +47,7 @@ public class MemberServiceImpl implements MemberService
String encodedText=null; String encodedText=null;
encodedText = egovPasswordEncoder.encryptPassword(vo.getLoginUserId()+vo.getPassword()); encodedText = egovPasswordEncoder.encryptPassword(vo.getLoginUserId()+vo.getPassword());
vo.setPassword(encodedText); vo.setPassword(encodedText);
vo.setBirthday(ariaCrypto.encode(vo.getBirthday())); vo.encodePrivateInfo();
vo.setMobileNo(ariaCrypto.encode(vo.getMobileNo()));
vo.setEmail(ariaCrypto.encode(vo.getEmail()));
vo.setZipCode(ariaCrypto.encode(vo.getZipCode()));
vo.setAddress(ariaCrypto.encode(vo.getAddress()));
vo.setAddressDetail(ariaCrypto.encode(vo.getAddressDetail()));
//회원가입 정보 //회원가입 정보
memberDAO.insertMemberInfo(vo); memberDAO.insertMemberInfo(vo);
//가입한 정보의 UID select //가입한 정보의 UID select

View File

@ -1,12 +1,70 @@
package nlib.user.service.impl; package nlib.user.service.impl;
import java.util.List;
import egovframework.com.ext.oauth.service.OAuthUniversalUser;
import egovframework.rte.psl.dataaccess.mapper.Mapper; import egovframework.rte.psl.dataaccess.mapper.Mapper;
import nlib.user.service.MemberSiteVO;
import nlib.user.service.NlibLoginVO; import nlib.user.service.NlibLoginVO;
/**
* <pre>
* @Class Name : UserInfoDAO.java
*
* @Description : 사용자의 관련 정보 제공 DAO
*
*
* @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
*
* </pre>
*
* @ ------------ -------- ---------------------------
* @ 수정일 수정자 수정내용
* @ ------------ -------- ---------------------------
* @ 2021. 9. 7. JSYOO 최초 생성
*
*
* @author 이씨플라자 * DIGITALSHIP JSYOO
* @since 2021. 9. 7.
* @version 1.0
*
*/
@Mapper("userInfoDAO") @Mapper("userInfoDAO")
public interface UserInfoDAO public interface UserInfoDAO
{ {
public NlibLoginVO selectMyInfo(NlibLoginVO vo) throws Exception; /** 사용자의 SNS 연동 리스트를 조회한다.
* @param vo
* @return
* @throws Exception
*/
public List<OAuthUniversalUser> selectSnsSignUpList(NlibLoginVO vo) throws Exception;
/** 정보를 수정한다.
* @param vo
* @throws Exception
*/
public void updateMyInfo(NlibLoginVO vo) throws Exception; public void updateMyInfo(NlibLoginVO vo) throws Exception;
/** 가입문화원 리스트를 조회한다.
* @param vo
* @return
*/
public List<MemberSiteVO> selectCenterSignUpList(NlibLoginVO vo) throws Exception;
/** SNS연동을 해지한다.
* @param oAuthVO
*/
public void deleteSnsLink(OAuthUniversalUser oAuthVO) throws Exception;
/** 문화원가입을 해지한다.
* @param siteVO
*/
public void deleteCenterLink(MemberSiteVO siteVO) throws Exception;
/** 사용자의 정보를 조회한다.
* @param vo
* @return
*/
public NlibLoginVO selectMyInfo(NlibLoginVO vo) throws Exception;
} }

View File

@ -1,14 +1,42 @@
package nlib.user.service.impl; package nlib.user.service.impl;
import java.util.List;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import egovframework.com.ext.oauth.service.OAuthUniversalUser;
import egovframework.rte.fdl.cryptography.EgovPasswordEncoder; import egovframework.rte.fdl.cryptography.EgovPasswordEncoder;
import nlib.cmm.crypto.AriaCrypto;
import nlib.user.service.MemberService; import nlib.user.service.MemberService;
import nlib.user.service.MemberSiteVO;
import nlib.user.service.NlibLoginVO; import nlib.user.service.NlibLoginVO;
import nlib.user.service.UserInfoService; import nlib.user.service.UserInfoService;
/**
* <pre>
* @Class Name : UserInfoServiceImpl.java
*
* @Description : 사용자의 정보를 조회하는 서비스
*
*
* @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
*
* </pre>
*
* @ ------------ -------- ---------------------------
* @ 수정일 수정자 수정내용
* @ ------------ -------- ---------------------------
* @ 2021. 9. 7. JSYOO 최초 생성
*
*
* @author 이씨플라자 * DIGITALSHIP JSYOO
* @since 2021. 9. 7.
* @version 1.0
*
*/
@Service("userInfoService") @Service("userInfoService")
public class UserInfoServiceImpl implements UserInfoService public class UserInfoServiceImpl implements UserInfoService
{ {
@ -18,12 +46,60 @@ public class UserInfoServiceImpl implements UserInfoService
@Resource(name = "egovEnvPasswordEncoderService") @Resource(name = "egovEnvPasswordEncoderService")
EgovPasswordEncoder egovPasswordEncoder; EgovPasswordEncoder egovPasswordEncoder;
@Resource(name = "ariaCrypto")
AriaCrypto ariaCrypto;
public NlibLoginVO selectMyInfo(NlibLoginVO vo) throws Exception {
return userInfoDAO.selectMyInfo(vo); /* 사용자의 SNS 연동 리스트를 조회한다.
* (non-Javadoc)
* @see nlib.user.service.UserInfoService#selectSnsSignUpList(nlib.user.service.NlibLoginVO)
*/
public List<OAuthUniversalUser> selectSnsSignUpList(NlibLoginVO vo) throws Exception {
return userInfoDAO.selectSnsSignUpList(vo);
} }
/* 정보를 수정한다.
* (non-Javadoc)
* @see nlib.user.service.UserInfoService#updateMyInfo(nlib.user.service.NlibLoginVO)
*/
public void updateMyInfo(NlibLoginVO vo) throws Exception { public void updateMyInfo(NlibLoginVO vo) throws Exception {
//회원정보 암호화
vo.encodePrivateInfo();
userInfoDAO.updateMyInfo(vo); userInfoDAO.updateMyInfo(vo);
} }
/* 가입문화원 리스트를 조회한다.
* (non-Javadoc)
* @see nlib.user.service.UserInfoService#selectCenterSignUpList(nlib.user.service.NlibLoginVO)
*/
public List<MemberSiteVO> selectCenterSignUpList(NlibLoginVO vo) throws Exception {
return userInfoDAO.selectCenterSignUpList(vo);
}
/* SNS연동을 해지한다.
* (non-Javadoc)
* @see nlib.user.service.UserInfoService#deleteSnsLink(egovframework.com.ext.oauth.service.OAuthUniversalUser)
*/
public void deleteSnsLink(OAuthUniversalUser oAuthVO) throws Exception {
userInfoDAO.deleteSnsLink(oAuthVO);
}
/* 문화원 가입을 해지한다.
* (non-Javadoc)
* @see nlib.user.service.UserInfoService#deleteCenterLink(nlib.user.service.MemberSiteVO)
*/
public void deleteCenterLink(MemberSiteVO siteVO) throws Exception {
userInfoDAO.deleteCenterLink(siteVO);
}
/* 사용자의 정보를 조회한다.
* (non-Javadoc)
* @see nlib.user.service.UserInfoService#selectMyInfo(nlib.user.service.NlibLoginVO)
*/
public NlibLoginVO selectMyInfo(NlibLoginVO vo) throws Exception {
vo.setMobileNo(ariaCrypto.encode(vo.getMobileNo()));
NlibLoginVO loginVO =userInfoDAO.selectMyInfo(vo);
// 개인정보 암호화 내용 복호화 처리
if(loginVO != null) {
loginVO.setMobileNo(AriaCrypto.decode(loginVO.getMobileNo()));
}
return loginVO;
}
} }

View File

@ -23,6 +23,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import org.apache.commons.lang.StringUtils;
import org.json.simple.JSONObject; import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser; import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException; import org.json.simple.parser.ParseException;
@ -60,6 +61,7 @@ import egovframework.com.ext.oauth.service.OAuthLogin;
import egovframework.com.ext.oauth.service.OAuthUniversalUser; import egovframework.com.ext.oauth.service.OAuthUniversalUser;
import egovframework.com.ext.oauth.service.OAuthVO; import egovframework.com.ext.oauth.service.OAuthVO;
import egovframework.rte.fdl.cryptography.EgovPasswordEncoder; import egovframework.rte.fdl.cryptography.EgovPasswordEncoder;
import nlib.cmm.NlibCommonController;
import nlib.cmm.crypto.AriaCrypto; import nlib.cmm.crypto.AriaCrypto;
import nlib.cmm.service.NlibProperty; import nlib.cmm.service.NlibProperty;
import nlib.cmm.session.SessionConfig; import nlib.cmm.session.SessionConfig;
@ -69,6 +71,7 @@ import nlib.info.service.InformService;
import nlib.mail.EmailSender; import nlib.mail.EmailSender;
import nlib.mail.service.EmailVO; import nlib.mail.service.EmailVO;
import nlib.restful.service.DataApiReqVO; import nlib.restful.service.DataApiReqVO;
import nlib.user.service.LoginService;
import nlib.user.service.MemberService; import nlib.user.service.MemberService;
import nlib.user.service.NlibLoginVO; import nlib.user.service.NlibLoginVO;
import nlib.user.service.MemberSiteVO; import nlib.user.service.MemberSiteVO;
@ -76,6 +79,7 @@ import nlib.user.service.UserInfoService;
import nlib.util.StringUtil; import nlib.util.StringUtil;
import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.security.core.Authentication;
/** /**
* <pre> * <pre>
@ -101,7 +105,7 @@ import org.springframework.mail.javamail.JavaMailSender;
*/ */
@Controller @Controller
public class MemberController { public class MemberController extends NlibCommonController{
//------------------------------------------- //-------------------------------------------
// SNS 연동 환경설정 정보 : context-oauth.xml 참고 // SNS 연동 환경설정 정보 : context-oauth.xml 참고
@ -125,6 +129,9 @@ public class MemberController {
@Resource(name="informService") @Resource(name="informService")
private InformService informService; private InformService informService;
@Resource(name="loginService")
private LoginService loginService;
@Resource(name = "egovEnvPasswordEncoderService") @Resource(name = "egovEnvPasswordEncoderService")
EgovPasswordEncoder egovPasswordEncoder; EgovPasswordEncoder egovPasswordEncoder;
@ -187,6 +194,10 @@ public class MemberController {
*/ */
@RequestMapping(value="/member/selectMemberJoiningInfo.do") @RequestMapping(value="/member/selectMemberJoiningInfo.do")
public String selectMemberJoiningInfo(HttpServletRequest req,ModelMap model,HttpSession session) throws Exception { public String selectMemberJoiningInfo(HttpServletRequest req,ModelMap model,HttpSession session) throws Exception {
//이용약관 개인정보제공동의
HashMap<String, String> termRet = informService.selectTermsInfo(NlibProperty.getString("nlib.council.cd"));
HashMap<String, String> privacyRet = informService.selectPrivacyInfo(NlibProperty.getString("nlib.council.cd"));
String jsessionId = session.getId(); String jsessionId = session.getId();
OAuthUniversalUser oauthUser = SessionConfig.getNewMemberInfo(jsessionId); OAuthUniversalUser oauthUser = SessionConfig.getNewMemberInfo(jsessionId);
@ -200,6 +211,14 @@ public class MemberController {
model.addAttribute("url","/nlib"+NlibProperty.getString("login.url")); model.addAttribute("url","/nlib"+NlibProperty.getString("login.url"));
return "nlib/cmm/alert"; return "nlib/cmm/alert";
} }
model.addAttribute("termTitle", termRet.get("TITLE"));
model.addAttribute("termContent", termRet.get("CONTENT"));
model.addAttribute("privacyTitle", privacyRet.get("TITLE"));
model.addAttribute("privacyContent", privacyRet.get("CONTENT"));
return "/nlib/member/selectMemberJoiningInfo"; return "/nlib/member/selectMemberJoiningInfo";
} }
@ -305,7 +324,7 @@ public class MemberController {
if(!(vo.getMobileVrfctNo().equals(oauthUser.getNlibVO().getMobileVrfctNo())) if(!(vo.getMobileVrfctNo().equals(oauthUser.getNlibVO().getMobileVrfctNo()))
||oauthUser.getNlibVO().getMobileVrfctDd() == null) ||oauthUser.getNlibVO().getMobileVrfctDd() == null)
{ {
model.addAttribute("msg","핸드폰인증에 문제가 있습니다. 다시 회원가입을 진행해주세요."); model.addAttribute("msg","핸드폰인증이 정상적이지않습니다. 다시 회원가입을 진행해주세요.");
model.addAttribute("url","${pageContext.request.contextPath}"+NlibProperty.getString("member.new.url")); model.addAttribute("url","${pageContext.request.contextPath}"+NlibProperty.getString("member.new.url"));
return "nlib/cmm/alert"; return "nlib/cmm/alert";
} }
@ -318,7 +337,7 @@ public class MemberController {
if(!(vo.getEmailVrfctDd().equals(oauthUser.getNlibVO().getEmailVrfctDd())) if(!(vo.getEmailVrfctDd().equals(oauthUser.getNlibVO().getEmailVrfctDd()))
||oauthUser.getNlibVO().getEmailVrfctDd() == null) ||oauthUser.getNlibVO().getEmailVrfctDd() == null)
{ {
model.addAttribute("msg","이메일인증에 문제가 있습니다. 다시 회원가입을 진행해주세요."); model.addAttribute("msg","이메일인증이 정상적이지않습니다. 다시 회원가입을 진행해주세요.");
model.addAttribute("url","${pageContext.request.contextPath}"+NlibProperty.getString("member.new.url")); model.addAttribute("url","${pageContext.request.contextPath}"+NlibProperty.getString("member.new.url"));
return "nlib/cmm/alert"; return "nlib/cmm/alert";
} }
@ -379,9 +398,24 @@ public class MemberController {
* @exception Exception * @exception Exception
*/ */
@RequestMapping(value="/member/emailCertNum.ajax" , method=RequestMethod.POST) @RequestMapping(value="/member/emailCertNum.ajax" , method=RequestMethod.POST)
public @ResponseBody void emailCertNum(HttpServletResponse response,HttpServletRequest request,HttpSession session) throws Exception{ public @ResponseBody Map<String,String> emailCertNum(HttpServletResponse response,HttpServletRequest request,HttpSession session) throws Exception{
String email = request.getParameter("email"); String email = request.getParameter("email");
Map<String,String> map = new HashMap<String,String>();
OAuthUniversalUser authUser= new OAuthUniversalUser();
authUser.setSnsUserId(email);
authUser.setSnsEmail(email);
//중복된 아이디가 있을시
if(memberService.selectAlreadySignUpId(authUser) != null)
{
map.put("msg","이미 사용중인 이메일입니다.");
map.put("emailCertYn","N");
return map;
}
EmailVO emailVO = new EmailVO(); EmailVO emailVO = new EmailVO();
//인증번호 생성 //인증번호 생성
String CertNumber=memberService.numberGen(6,1); String CertNumber=memberService.numberGen(6,1);
System.out.println(CertNumber); System.out.println(CertNumber);
@ -398,6 +432,7 @@ public class MemberController {
oauthUser.setNlibVO(vo); oauthUser.setNlibVO(vo);
SessionConfig.setNewMemberInfo(jsessionId,oauthUser); SessionConfig.setNewMemberInfo(jsessionId,oauthUser);
//이메일 발송 //이메일 발송
// 결과가 정상이면, 안내 메일 발송 // 결과가 정상이면, 안내 메일 발송
// > 템플릿파일에서 내용 mailing.sender.membership.template // > 템플릿파일에서 내용 mailing.sender.membership.template
@ -426,8 +461,9 @@ public class MemberController {
emailVO.setSubject(subject); emailVO.setSubject(subject);
emailVO.setContent(contents); emailVO.setContent(contents);
emailSender.SendEmail(emailVO); emailSender.SendEmail(emailVO);
map.put("msg","이메일 인증번호가 발송됐습니다.");
//------------ map.put("emailCertYn","Y");
return map;
} }
/** /**
@ -519,6 +555,19 @@ public class MemberController {
} }
} }
/**
* 회원탈퇴
* @exception Exception
*/
@RequestMapping(value="/member/deleteMembershipForm.do")
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 * @exception Exception
@ -536,7 +585,7 @@ public class MemberController {
@RequestMapping(value="/member/initPassword.ajax") @RequestMapping(value="/member/initPassword.ajax")
public @ResponseBody String initPassword(NlibLoginVO vo,HttpServletResponse response,HttpServletRequest request,ModelMap model) throws Exception{ public @ResponseBody String initPassword(NlibLoginVO vo,HttpServletResponse response,HttpServletRequest request,ModelMap model) throws Exception{
NlibLoginVO loginVO =userInfoService.selectMyInfo(vo); NlibLoginVO loginVO=userInfoService.selectMyInfo(vo);
EmailVO email = new EmailVO(); EmailVO email = new EmailVO();
@ -546,9 +595,9 @@ public class MemberController {
String InitPwd=memberService.createInitPwd(); String InitPwd=memberService.createInitPwd();
String encodedText=null; String encodedText=null;
//ID와 핸드폰 번호가 일치하는지 확인 //ID와 핸드폰 번호가 일치하는지 확인
if(loginVO!=null && (loginVO.getMobileNo().equals(vo.getMobileNo()) && loginVO.getLoginUserId().equals(vo.getLoginUserId()))) if(loginVO!=null && loginVO.getLoginUserId().equals(vo.getLoginUserId()))
{ {
String reciver = vo.getLoginUserId(); //받을사람의 이메일입니다.-> naver nate 등등 String reciver = vo.getLoginUserId(); //받을사람의 이메일입니다.-> naver nate 등등
String subject = "온라인자료대출시스템 비밀번호 초기화 메일입니다."; String subject = "온라인자료대출시스템 비밀번호 초기화 메일입니다.";
@ -572,11 +621,11 @@ public class MemberController {
contents+=readLine; contents+=readLine;
} }
encodedText = egovPasswordEncoder.encryptPassword(InitPwd); encodedText = egovPasswordEncoder.encryptPassword(loginVO.getLoginUserId()+InitPwd);
vo.setPassword(encodedText); vo.setPassword(encodedText);
vo.setMbInfoId(gUserId); vo.setMbInfoId(gUserId);
//암호화된 비밀번호로 수정 //암호화된 비밀번호로 수정
memberService.changePassword(vo); memberService.changePassword(vo);
@ -598,7 +647,62 @@ public class MemberController {
return message; return message;
} }
/**
* 비밀번호 변경
* @exception Exception
*/
@RequestMapping(value="/member/changePassword.ajax")
public @ResponseBody String changePassword(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 newPassword=egovPasswordEncoder.encryptPassword(loginVO.getLoginUserId()+request.getParameter("newPassword"));
String message="";
if(loginVO!=null && (loginVO.getPassword().equals(password)))
{
loginVO.setPassword(newPassword);
//암호화된 비밀번호로 수정
memberService.changePassword(loginVO);
message="비밀번호 변경이 처리되었습니다.";
}else {
message="기존 비밀번호가 올바르지 않습니다.";
}
return message;
}
/** * 이메일 masking 후 리턴<br> * 변환 실패시 입력값 그대로 리턴<br> * 이메일 아이디 앞 2자리 노출<br> * 마스킹 처리는 글자수 상관없이 5자리로 노출 * */
public String maskingEmail(String email){
try{
if(StringUtils.isEmpty(email) || !email.contains("@")){
return email;
}
String[] emailSplited = email.split("@");
if(emailSplited.length != 2){
return email;
}
if(emailSplited[0].length() > 2){
String str="";
for(int i=2;emailSplited[0].length()>i;i++)
{
str+="*";
}
return email.substring(0, 2) + str+"@" + emailSplited[1];
}
else{
return email;
}
}
catch (Exception e){
} return email;
}
/** /**
* 회원가입 SNS 구글인증 * 회원가입 SNS 구글인증
* @exception Exception * @exception Exception

View File

@ -1,7 +1,9 @@
package nlib.user.web; package nlib.user.web;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -9,18 +11,25 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import egovframework.com.ext.oauth.service.OAuthUniversalUser;
import egovframework.rte.fdl.cryptography.EgovPasswordEncoder; import egovframework.rte.fdl.cryptography.EgovPasswordEncoder;
import nlib.restful.service.DataApiReqVO; import nlib.restful.service.DataApiReqVO;
import nlib.security.SecUserVO; import nlib.security.SecUserVO;
import nlib.user.service.LoginService;
import nlib.user.service.MemberService; import nlib.user.service.MemberService;
import nlib.user.service.MemberSiteVO;
import nlib.user.service.NlibLoginVO; import nlib.user.service.NlibLoginVO;
import nlib.user.service.UserInfoService; import nlib.user.service.UserInfoService;
import nlib.cmm.NlibCommonController;
import nlib.cmm.service.NlibProperty;
/** /**
@ -46,11 +55,14 @@ import nlib.user.service.UserInfoService;
* *
*/ */
@Controller @Controller
public class UserInfoController { public class UserInfoController extends NlibCommonController {
@Resource(name="userInfoService") @Resource(name="userInfoService")
private UserInfoService userInfoService; private UserInfoService userInfoService;
@Resource(name="loginService")
private LoginService loginService;
@Resource(name = "egovEnvPasswordEncoderService") @Resource(name = "egovEnvPasswordEncoderService")
EgovPasswordEncoder egovPasswordEncoder; EgovPasswordEncoder egovPasswordEncoder;
@ -69,20 +81,36 @@ public class UserInfoController {
*/ */
@RequestMapping(value="/userInfo/putMyInfo.do") @RequestMapping(value="/userInfo/putMyInfo.do")
public String putMyInfo(NlibLoginVO vo,HttpServletResponse response,HttpServletRequest request,Authentication authentication,ModelMap model) throws Exception{ public String putMyInfo(NlibLoginVO vo,HttpServletResponse response,HttpServletRequest request,Authentication authentication,ModelMap model) throws Exception{
NlibLoginVO loginVO =userInfoService.selectMyInfo(vo); //사용자 정보를 가져온다.
NlibLoginVO loginVO = getNlibLoginVO(authentication);
loginVO.setJoinCouncilCd(getCurCouncilCd(request));
loginVO = loginService.selectLoginUserInfo(loginVO);
List<OAuthUniversalUser> snsList = new ArrayList<OAuthUniversalUser>();
List<MemberSiteVO> centerList = new ArrayList<MemberSiteVO>();
//sns연동 계정 리스트
snsList = userInfoService.selectSnsSignUpList(loginVO);
//가입된 문화원 리스트
centerList = userInfoService.selectCenterSignUpList(loginVO);
String encodedText=null; String encodedText=null;
encodedText = egovPasswordEncoder.encryptPassword(vo.getPassword()); encodedText = egovPasswordEncoder.encryptPassword(loginVO.getLoginUserId()+vo.getPassword());
vo.setPassword(encodedText); vo.setPassword(encodedText);
//암호화된 패스워드 비교 //암호화된 패스워드 비교
if(loginVO.getPassword().equals(vo.getPassword())) { if(loginVO.getPassword().equals(vo.getPassword())) {
model.addAttribute("loginVO",loginVO); model.addAttribute("loginVO",loginVO);
model.addAttribute("centerList",centerList);
model.addAttribute("snsList",snsList);
return "nlib/userInfo/putMyInfo"; return "nlib/userInfo/putMyInfo";
}else { }else {
String message="비밀번호가 잘못되었습니다."; model.addAttribute("msg","비밀번호가 일치하지않습니다.");
model.addAttribute("message",message); model.addAttribute("url","/nlib/userInfo/pwCertMyInfo.do");
return "nlib/userInfo/pwCertMyInfo"; return "nlib/cmm/alert";
} }
} }
@ -100,6 +128,7 @@ public class UserInfoController {
userInfoService.updateMyInfo(vo); userInfoService.updateMyInfo(vo);
} }
/** /**
* 정보 수정 password 인증 * 정보 수정 password 인증
* @exception Exception * @exception Exception
@ -109,4 +138,31 @@ public class UserInfoController {
return "nlib/userInfo/pwCertMyInfo"; return "nlib/userInfo/pwCertMyInfo";
} }
/** SNS연동을 해지한다.
* @param response
* @param request
* @return
* @return
* @throws Exception
*/
@RequestMapping(value="/userInfo/deleteSnsLink.ajax")
public @ResponseBody void deleteSnsLink(HttpServletResponse response,HttpServletRequest request) throws Exception{
OAuthUniversalUser oAuthVO = new OAuthUniversalUser();
oAuthVO.setMbSnsId(request.getParameter("mbSnsId"));
userInfoService.deleteSnsLink(oAuthVO);
}
/** 문화원 가입을 해지한다.
* @param response
* @param request
* @return
* @throws Exception
*/
@RequestMapping(value="/userInfo/deleteCenterLink.ajax")
public @ResponseBody void deleteCenterLink(HttpServletResponse response,HttpServletRequest request) throws Exception{
MemberSiteVO siteVO = new MemberSiteVO();
siteVO.setMbSiteId(request.getParameter("mbSiteId"));
userInfoService.deleteCenterLink(siteVO);
}
} }

View File

@ -75,14 +75,13 @@
<!-- 비밀번호 변경 --> <!-- 비밀번호 변경 -->
<update id="changePassword" parameterType="nlib.user.service.NlibLoginVO"> <update id="changePassword" parameterType="nlib.user.service.NlibLoginVO">
UPDATE UPDATE
TMP_SM_USER MB_INFO
SET SET
USER_PWD=#{userPwd} PASSWORD=#{password}
,MOD_ID = #{userId} ,MOD_ID = #{mbInfoId}
,MOD_DD = SYSDATE() ,MOD_DD = NOW()
WHERE 1=1 WHERE 1=1
AND LOGIN_USER_ID = #{loginUserId} AND LOGIN_USER_ID = #{loginUserId}
AND TEL_NO = #{telNo}
</update> </update>
<!-- 회원가입시 SNS인증한 계정 ID와 일치하는 계정이 있는지 체크 --> <!-- 회원가입시 SNS인증한 계정 ID와 일치하는 계정이 있는지 체크 -->
@ -108,6 +107,7 @@
MB_SNS MB_SNS
WHERE 1=1 WHERE 1=1
AND SNS_USER_ID = #{snsUserId} AND SNS_USER_ID = #{snsUserId}
AND UNLINK_DD IS NULL
) MB ) MB
GROUP BY MB_INFO_ID GROUP BY MB_INFO_ID
</select> </select>
@ -122,6 +122,7 @@
MB_INFO MB_INFO
WHERE 1=1 WHERE 1=1
AND MOBILE_NO = #{mobileNo} AND MOBILE_NO = #{mobileNo}
LIMIT 1
</select> </select>
<!-- 회원가입시 sns 계정 추가 , 기존 계정 ID와 일치시 통합처리시 추가 --> <!-- 회원가입시 sns 계정 추가 , 기존 계정 ID와 일치시 통합처리시 추가 -->
@ -190,7 +191,8 @@
MB_SITE MB_SITE
WHERE 1=1 WHERE 1=1
AND MB_INFO_ID = #{mbInfoId} AND MB_INFO_ID = #{mbInfoId}
AND JOIN_COUNCIL_CD = #{joinCouncilCd}; AND JOIN_COUNCIL_CD = #{joinCouncilCd}
AND UNLINK_DD IS NULL;
</select> </select>
<!-- SnsId로 기가입자인지 판별 --> <!-- SnsId로 기가입자인지 판별 -->
@ -201,6 +203,8 @@
MB_SNS MB_SNS
WHERE 1=1 WHERE 1=1
AND SNS_ID = #{snsId} AND SNS_ID = #{snsId}
AND SNS_TYPE = #{snsType}; AND SNS_TYPE = #{snsType}
AND UNLINK_DD IS NULL
</select> </select>
</mapper> </mapper>

View File

@ -5,7 +5,6 @@
<resultMap type="nlib.user.service.NlibLoginVO" id="NlibLoginVO"> <resultMap type="nlib.user.service.NlibLoginVO" id="NlibLoginVO">
<result column="MB_INFO_ID" property="mbInfoId"/> <result column="MB_INFO_ID" property="mbInfoId"/>
<result column="LOGIN_USER_ID" property="loginUserId"/> <result column="LOGIN_USER_ID" property="loginUserId"/>
<result column="USER_DIV" property="userDiv"/>
<result column="NAME" property="name"/> <result column="NAME" property="name"/>
<result column="PASSWORD" property="password"/> <result column="PASSWORD" property="password"/>
<result column="BIRTHDAY" property="birthday"/> <result column="BIRTHDAY" property="birthday"/>
@ -16,34 +15,119 @@
<result column="GENDER" property="gender"/> <result column="GENDER" property="gender"/>
<result column="REG_ID" property="regId"/> <result column="REG_ID" property="regId"/>
<result column="MOD_ID" property="modId"/> <result column="MOD_ID" property="modId"/>
</resultMap> </resultMap>
<resultMap type="egovframework.com.ext.oauth.service.OAuthUniversalUser" id="OAuthUniversalUser">
<select id="selectMyInfo" parameterType="nlib.user.service.NlibLoginVO" resultMap="NlibLoginVO"> <result column="MB_SNS_ID" property="mbSnsId"/>
SELECT <result column="MB_INFO_ID" property="mbInfoId"/>
LOGIN_USER_ID <result column="SNS_TYPE" property="snsType"/>
FROM <result column="SNS_ID" property="snsId"/>
TMP_SM_USER <result column="SNS_USER_ID" property="snsUserId"/>
WHERE 1=1 <result column="REG_DD" property="regDd"/>
AND USER_ID="U2000000003" </resultMap>
<resultMap type="nlib.user.service.MemberSiteVO" id="MemberSiteVO">
<result column="MB_SITE_ID" property="mbSiteId"/>
<result column="MB_INFO_ID" property="mbInfoId"/>
<result column="JOIN_TYPE" property="joinType"/>
<result column="JOIN_AGREE_DD" property="joinAgreeDd"/>
<result column="JOIN_COUNCIL_CD" property="joinCouncilCd"/>
<result column="JOIN_COUNCIL_NM" property="joinCouncilNm"/>
<result column="MASTER_YN" property="masterYn"/>
</resultMap>
<!-- sns계정 리스트 -->
<select id="selectSnsSignUpList" parameterType="nlib.user.service.NlibLoginVO" resultMap="OAuthUniversalUser">
SELECT
MB_SNS_ID
,MB_INFO_ID
,SNS_TYPE
,SNS_ID
,SNS_USER_ID
,REG_DD
FROM
MB_SNS
WHERE 1=1
AND MB_INFO_ID = #{mbInfoId}
AND UNLINK_DD IS NULL
</select> </select>
<!-- 사용자의 정보를 조회한다. -->
<select id="selectMyInfo" parameterType="nlib.user.service.NlibLoginVO" resultMap="NlibLoginVO">
SELECT
MB_INFO_ID
,LOGIN_USER_ID
,MOBILE_NO
FROM
MB_INFO
WHERE 1=1
AND MOBILE_NO = #{mobileNo}
AND LOGIN_USER_ID = #{loginUserId}
</select>
<!-- 내 정보 수정 -->
<update id="updateMyInfo" parameterType="nlib.user.service.NlibLoginVO"> <update id="updateMyInfo" parameterType="nlib.user.service.NlibLoginVO">
/* updateMyInfo */
UPDATE UPDATE
TMP_SM_USER MB_INFO
SET SET
USER_NM=#{userNm} NAME=#{name}
,USER_PWD=#{userPwd} ,BIRTHDAY=#{birthday}
,BIRTHDATE=#{birthdate} ,MOBILE_NO=#{mobileNo}
,ZIP_CODE=#{zipCode}
,ADDRESS=#{address}
,ADDRESS_DETAIL=#{addressDetail}
,GENDER=#{gender} ,GENDER=#{gender}
,TEL_NO=#{telNo} ,MOD_ID=#{mbInfoId}
,ZIPCODE=#{zipcode} ,MOD_DD=NOW()
,ADDR1=#{addr1}
,ADDR2=#{addr2}
WHERE 1=1 WHERE 1=1
AND USER_ID="U2000000003" AND MB_INFO_ID=#{mbInfoId}
</update> </update>
<!-- 가입문화원 리스트를 조회한다. -->
<select id="selectCenterSignUpList" parameterType="nlib.user.service.NlibLoginVO" resultMap="MemberSiteVO">
SELECT
mb.MB_SITE_ID
,mb.MB_INFO_ID
,mb.JOIN_TYPE
,mb.JOIN_AGREE_DD
,mb.JOIN_COUNCIL_CD
,sm.DEPT_NM JOIN_COUNCIL_NM
,mb.MASTER_YN
FROM
MB_SITE mb
LEFT OUTER JOIN
SM_DEPT sm
ON sm.ORG_CD = mb.JOIN_COUNCIL_CD
WHERE 1=1
AND MB_INFO_ID = #{mbInfoId}
AND UNLINK_DD IS NULL
ORDER BY mb.MB_SITE_ID
</select>
<!-- SNS연동을 해지한다. -->
<update id="deleteSnsLink" parameterType="egovframework.com.ext.oauth.service.OAuthUniversalUser">
UPDATE
MB_SNS
SET
UNLINK_DD=NOW()
WHERE 1=1
<if test="mbSnsId != null">
AND MB_SNS_ID = #{mbSnsId};
</if>
<if test="mbInfoId != null">
AND MB_INFO_ID = #{mbInfoId};
</if>
</update>
<!-- 문화원의 가입을 해지한다. -->
<update id="deleteCenterLink" parameterType="nlib.user.service.MemberSiteVO">
UPDATE
MB_SITE
SET
UNLINK_DD=NOW()
WHERE 1=1
<if test="mbSiteId != null">
AND MB_SITE_ID = #{mbSiteId};
</if>
<if test="mbInfoId != null">
AND MB_INFO_ID = #{mbInfoId};
</if>
</update>
</mapper> </mapper>

View File

@ -0,0 +1,45 @@
<%
/**
* <pre>
* @Class Name : deleteMembershipForm.jsp
*
* @Description : 회원탈퇴폼
*
*
* @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
*
* </pre>
*
* @ ------------ -------- ---------------------------
* @ 수정일 수정자 수정내용
* @ ------------ -------- ---------------------------
* @ 2021. 9. 9. JSYOO 최초 생성
*
*
* @author 이씨플라자 * DIGITALSHIP JSYOO
* @since 2021. 9. 9.
* @version 1.0
*
*/
%>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
<!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">
</head>
<body>
<form id="deleteMembershipForm" name="deleteMembershipForm">
<p1>회원탈퇴</p1><br>
이름 : <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="취소">
</form>
</body>
</html>

View File

@ -43,19 +43,24 @@ function goFindPw(){
var data = $("form[name=initPw]").serialize(); var data = $("form[name=initPw]").serialize();
$.ajax({ if(confirm("비밀번호를 초기화 하시겠습니까?"))
url : "/nlib/member/initPassword.ajax", {
type : "POST", $.ajax({
data : data, url : "/nlib/member/initPassword.ajax",
success : function(result){ type : "POST",
data : data,
alert(result); success : function(result){
location.href='${pageContext.request.contextPath}/login/loginForm.do';
alert(result);
},error : function(){ location.href='${pageContext.request.contextPath}/login/loginForm.do';
alert("이메일 발송에 실패하였습니다.");
} },error : function(){
}) alert("이메일 발송에 실패하였습니다.");
}
})
}
} }
</script> </script>
</head> </head>

View File

@ -110,15 +110,12 @@ $(document).ready(function() {
if($("#snsMobileNo").val() == $("#mobileNo").val()) if($("#snsMobileNo").val() == $("#mobileNo").val())
{ {
$("#mobileCertYn").val("Y"); $("#mobileCertYn").val("Y");
$("#mobileCertForm").css("display","none");
$("#mobileCertSendBtn").css("display","none"); $("#mobileCertSendBtn").css("display","none");
$("#mobileCertForm").css("display","none");
}else{ }else{
$("#mobileCertYn").val("N"); $("#mobileCertYn").val("N");
$("#mobileCertForm").css("display","block")
$("#mobileCertSendBtn").css("display","block"); $("#mobileCertSendBtn").css("display","block");
} }
}); });
<% <%
//아이디가 변하는것 실시간 감지 //아이디가 변하는것 실시간 감지
@ -127,17 +124,13 @@ $(document).ready(function() {
if($("#snsUserId").val() == $("#loginUserId").val()) if($("#snsUserId").val() == $("#loginUserId").val())
{ {
$("#emailCertYn").val("Y"); $("#emailCertYn").val("Y");
$("#emailCertForm").css("display","none");
$("#emailCertSendBtn").css("display","none"); $("#emailCertSendBtn").css("display","none");
$("#emailCertForm").css("display","none");
}else{ }else{
$("#emailCertYn").val("N"); $("#emailCertYn").val("N");
$("#emailCertForm").css("display","block")
$("#emailCertSendBtn").css("display","block"); $("#emailCertSendBtn").css("display","block");
} }
$("#emailCertYn").val("N");
$("#getEmailCert").css("display","block")
//snsUserId
}); });
}) })
<% <%
@ -160,11 +153,18 @@ function emailCert(){
async: false, async: false,
data : {"email" : $("#loginUserId").val()}, data : {"email" : $("#loginUserId").val()},
success : function(result){ success : function(result){
alert("이메일 인증번호가 발송됐습니다."); alert(result.msg);
$("#emailCertYn").val("N");
//인증번호 확인창
$("#emailCertForm").css("display","block")
if(result.emailCertYn=="Y")
{
$("#emailCertYn").val("Y");
$("#emailCertForm").css("display","block")
}
if(result.emailCertYn=="N")
{
$("#emailCertYn").val("N");
$("#emailCertForm").css("display","none")
}
},error : function(){ },error : function(){
} }
}) })
@ -221,6 +221,7 @@ function mobileCert(){
success : function(result){ success : function(result){
alert("인증번호가 발송됐습니다."); alert("인증번호가 발송됐습니다.");
$("#mobileCertYn").val("N"); $("#mobileCertYn").val("N");
$("#mobileCertForm").css("display","block")
},error : function(){ },error : function(){
} }
}) })

View File

@ -22,8 +22,14 @@
* *
*/ */
%> %>
<%@ page language="java" contentType="text/html; charset=UTF-8" <%@ page language="java" contentType="text/html; charset=UTF-8" %>
pageEncoding="UTF-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html> <html>
<head> <head>
@ -32,6 +38,18 @@
<title>Insert title here</title> <title>Insert title here</title>
<script> <script>
function snsCertForm(){ function snsCertForm(){
if(document.getElementsByName('agree')[0].focus())
{
alert("이용약관에 동의해주세요.");
document.termsForm.agree[0].focus()
return false;
}
if(document.getElementsByName('agree')[1].focus())
{
alert("개인정보처리정책에 동의해주세요.");
document.termsForm.agree[1].focus()
return false;
}
if(document.getElementById('agree').checked) if(document.getElementById('agree').checked)
{ {
location.href="${pageContext.request.contextPath}/member/insertMemberInfoForm.do"; location.href="${pageContext.request.contextPath}/member/insertMemberInfoForm.do";
@ -44,9 +62,15 @@ function snsCertForm(){
</head> </head>
<body> <body>
<div style="width:500px;"> <div style="width:500px;">
<textarea style="height:200px;width:500px;">${result.info["terms"]}</textarea> <form id="termsForm" name="termsForm">
<br><div style="float: right;"><input type="checkbox" id="agree" >동의</div> <p1><c:out value="${termTitle}" escapeXml="false"/></p1>
<br><br><input type="button" value="다음" onclick="snsCertForm();" style="float: right;"> <textarea style="height:200px;width:500px;"><c:out value="${termContent}" escapeXml="false"/></textarea>
<br><div style="float: right;"><input type="checkbox" name="agree" >동의</div>
<p1><c:out value="${privacyTitle}" escapeXml="false"/></p1>
<textarea style="height:200px;width:500px;"><c:out value="${privacyContent}" escapeXml="false"/></textarea>
<br><div style="float: right;"><input type="checkbox" name="agree" >동의</div>
<br><br><input type="button" value="다음" onclick="snsCertForm();" style="float: right;">
</form>
</div> </div>
</body> </body>
</html> </html>

View File

@ -38,12 +38,40 @@
<title>Insert title here</title> <title>Insert title here</title>
<script type="text/javaScript" language="javascript" defer="defer"> <script type="text/javaScript" language="javascript" defer="defer">
$(document).ready(function() { $(document).ready(function() {
// sns연동이 하나일때 연결해제버튼 제거
if($("input[name='unlinkBtn']").length==1)
{
$("input[name='unlinkBtn']").remove();
};
<%
//새비밀번호,새비밀번호확인이 일치하는지 확인
%>
$("#newPassword,#newPasswordConfirm").on("propertychange change keyup paste", function() {
if($("#newPassword").val() == $("#newPasswordConfirm").val())
{
$("#passwordMsg *").remove();
$("#passwordMsg").append("<a>비밀번호가 일치합니다.</a>");
}else{
$("#passwordMsg *").remove();
$("#passwordMsg").append("<a>비밀번호가 일치하지않습니다.</a>");
}
});
<% <%
//핸드폰 번호가 변하는것 실시간 감지 //핸드폰 번호가 변하는것 실시간 감지
%> %>
$("#mobileNo").on("propertychange change keyup paste input", function() { $("#mobileNo").on("propertychange change keyup paste input", function() {
$("#mobileCertYn").val("N"); if($("#snsMobileNo").val() == $("#mobileNo").val())
{
$("#mobileCertYn").val("Y");
$("#mobileCertSendBtn").css("display","none");
$("#mobileCertForm").css("display","none");
}else{
$("#mobileCertYn").val("N");
$("#mobileCertSendBtn").css("display","block");
}
}); });
$("input:radio[name='gender']:radio[value='${loginVO.gender}']").prop("checked",true); $("input:radio[name='gender']:radio[value='${loginVO.gender}']").prop("checked",true);
var birthday='${loginVO.birthday}'; var birthday='${loginVO.birthday}';
@ -51,19 +79,9 @@ $(document).ready(function() {
$("#birth_yy").val(birthday.substr(0,4)); $("#birth_yy").val(birthday.substr(0,4));
$("#birth_mm").val(birthday.substr(4,2)); $("#birth_mm").val(birthday.substr(4,2));
$("#birth_dd").val(birthday.substr(6,2)); $("#birth_dd").val(birthday.substr(6,2));
alert("22222 <c:out value="${loginVO.address}" escapeXml="false"/>");
}) })
function update(){ function update(){
var p = document.getElementById('password');
var p_cf = document.getElementById('passwordConfirm');
if(p.value != p_cf.value)
{
alert("비밀번호가 일치하지 않습니다. 확인해 주세요.");
p_cf.focus();
return false;
}
if(!checkBirthday()) if(!checkBirthday())
{ {
alert("생년월일이 형식에 맞지 않습니다. 확인해주세요."); alert("생년월일이 형식에 맞지 않습니다. 확인해주세요.");
@ -100,10 +118,34 @@ function update(){
} }
}) })
return false; }
}else{ return false;
}
function changePassword(){
var p = document.getElementById('newPassword');
var p_cf = document.getElementById('newPasswordConfirm');
if(p.value != p_cf.value)
{
alert("새 비밀번호가 일치하지 않습니다. 확인해 주세요.");
p_cf.focus();
return false; return false;
} }
$.ajax({
url : "/nlib/member/changePassword.ajax",
type : "POST",
async: false,
data : {"password" : $("#password").val()
,"newPassword" : $("#newPassword").val()
},
success : function(result){
alert(result);
},error : function(){
}
})
return false;
} }
<% <%
@ -128,7 +170,7 @@ function mobileCert(){
data : {"mobileNo" : $("#mobileNo").val()}, data : {"mobileNo" : $("#mobileNo").val()},
success : function(result){ success : function(result){
alert("인증번호가 발송됐습니다."); alert("인증번호가 발송됐습니다.");
//인증번호 확인창 $("#mobileCertYn").val("N");
$("#mobileCertForm").css("display","block") $("#mobileCertForm").css("display","block")
},error : function(){ },error : function(){
@ -139,14 +181,14 @@ function mobileCert(){
<% <%
//핸드폰 인증번호 확인 //핸드폰 인증번호 확인
%> %>
function certNumCheck(){ function certMobileCheck(){
<% <%
//ajax 사용자가 입력한 번호를 보내 RESTfull server에서 확인 success or fail 반환 (3분이내인지도) //ajax 사용자가 입력한 번호를 보내 RESTfull server에서 확인 success or fail 반환 (3분이내인지도)
%> %>
$.ajax({ $.ajax({
url : "/nlib/member/mobileCertNumChk.ajax", url : "/nlib/member/mobileCertNumChk.ajax",
type : "POST", type : "POST",
data : {"mobileCertNum" : $("#mobileCertNum").val(), data : {"mobileVrfctNo" : $("#mobileVrfctNo").val(),
"mobileNo" : $("#mobileNo").val()}, "mobileNo" : $("#mobileNo").val()},
async: false, async: false,
success : function(result){ success : function(result){
@ -255,6 +297,53 @@ function calcAge(birth) {
var age = monthDay < birthdaymd ? year - birthdayy - 1 : year - birthdayy; var age = monthDay < birthdaymd ? year - birthdayy - 1 : year - birthdayy;
return age; return age;
} }
<%
/* SNS 연동해지 */
%>
function snsUnlink(snsId){
if(confirm("SNS연동을 해지하시겠습니까?"))
{
$.ajax({
url : "${pageContext.request.contextPath}/userInfo/deleteSnsLink.ajax",
type : "POST",
async: false,
data : {mbSnsId:snsId},
success : function(result){
alert("연동이 해지되었습니다.");
$("#s"+snsId).remove();
if($("input[name='unlinkBtn']").length==1)
{
$("input[name='unlinkBtn']").remove();
};
},error : function(){
}
})
}
}
<%
/* 문화원 가입해지 */
%>
function centerUnlink(siteId){
if(confirm("문화원 가입을 해제하시겠습니까?"))
{
$.ajax({
url : "${pageContext.request.contextPath}/userInfo/deleteCenterLink.ajax",
type : "POST",
async: false,
data : {mbSiteId:siteId},
success : function(result){
alert("가입이 해지되었습니다.");
$("#c"+siteId).remove();
},error : function(){
}
})
}
}
</script> </script>
<style type="text/css"> <style type="text/css">
@ -369,46 +458,101 @@ label.error {
</select> </select>
<input type="text" id="birth_dd" name="birth_dd" size="2" maxlength="2" placeholder="일" size="4" required> <input type="text" id="birth_dd" name="birth_dd" size="2" maxlength="2" placeholder="일" size="4" required>
</td> </td>
</tr> </tr>
<tr>
<td id="title">비밀번호</td>
<td>
<input type="password" id="password" name="password" minlength="8" maxlength="16"
oninvalid="this.setCustomValidity('8~16자 영문 대 소문자, 숫자, 특수문자를 사용하세요.')"
oninput="this.setCustomValidity('')"
pattern="^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[$@$!%*#?&])[A-Za-z\d$@$!%*#?&]{8,16}$" required>
</td>
</tr>
<tr>
<td id="title">비밀번호 확인</td>
<td>
<input type="password" id="passwordConfirm" name="passwordConfirm" minlength="8" maxlength="16" required>
</td>
</tr>
<tr> <tr>
<td id="title">주소</td> <td id="title">주소</td>
<td> <td>
<input type="text" id="zipCode" name="zipCode" value="<c:out value="${loginVO.zipCode}"/>" readonly ><button type="button" style="text-align:left;" class="btn-warning" onclick="goPopup()">주소검색</button><br> <input type="text" id="zipCode" name="zipCode" value="<c:out value="${loginVO.zipCode}"/>" readonly ><button type="button" style="text-align:left;" class="btn-warning" onclick="sample6_execDaumPostcode()">주소검색</button><br>
<input type="text" id="address" name="address" value="<c:out value="${loginVO.address}" escapeXml="false"/>" readonly /> <input type="text" id="address" name="address" value="<c:out value="${loginVO.address}" escapeXml="false"/>" readonly />
<input type="text" id="addressDetail" name="addressDetail" value="<c:out value="${loginVO.addressDetail}"/>" readonly /> <input type="text" id="addressDetail" name="addressDetail" value="<c:out value="${loginVO.addressDetail}"/>" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td id="title">휴대전화</td> <td id="title">휴대전화</td>
<td id="Cert"> <td id="Cert">
<input type="text" id="mobileNo" name="mobileNo" required value="<c:out value="${loginVO.mobileNo}"/>" ><button type="button" style="text-align:left;" class="btn-warning" onclick="mobileCert()" required>인증번호 받기</button> <input type="text" id="mobileNo" name="mobileNo" required value="<c:out value="${loginVO.mobileNo}"/>" ><button type="button" id="mobileCertSendBtn" style="text-align:left;" class="btn-warning" onclick="mobileCert()" required>인증번호 받기</button>
<div id="mobileCertForm" style="display:none;"><br><input type='text' id='mobileCertNum' name='mobileCertNum'> <button type='button' style='text-align:left;' class='btn-warning' onclick='certNumCheck()' >인증번호 확인</button></div> <div id="mobileCertForm" style="display:none;"><br><input type='text' id='mobileVrfctNo' name='mobileVrfctNo'> <button type='button' style='text-align:left;' class='btn-warning' onclick='certMobileCheck()' >인증번호 확인</button></div>
</td> </td>
</tr> </tr>
</table> </table>
<br> <br>
<input type="hidden" id="mobileCertYn" name="mobileCertYn" value=<c:out value="Y"/>> <input type="hidden" id="mobileCertYn" name="mobileCertYn" value=<c:out value="Y"/>>
<input type="hidden" id="birthday" name="birthday" > <input type="hidden" id="birthday" name="birthday" >
<input type="hidden" id="mbInfoId" name="mbInfoId" value="<c:out value="${loginVO.mbInfoId}"/>" >
<input type="hidden" id="extMobileNo" name="extMobileNo" value="<c:out value="${loginVO.mobileNo}"/>">
<input type="submit" value="수정"/> <input type="button" onclick="javascript:location.href='${pageContext.request.contextPath}/userInfo/getMyInfo.do';" value="취소"> <input type="submit" value="수정"/> <input type="button" onclick="javascript:location.href='${pageContext.request.contextPath}/userInfo/getMyInfo.do';" value="취소">
</form> </form>
<a href="${pageContext.request.contextPath}/member/deleteMembershipForm.do">소장자료관을 더 이상 사용하고 싶지 않으신가요?</a>
</div>
<div>
<br>
<p1>SNS연동 </p1><br>
<c:forEach var="snsList" items="${snsList}" varStatus="status">
<a id="<c:out value="s${snsList.mbSnsId}" />"><c:out value="${snsList.snsType }" /> 이메일: <c:out value="${snsList.mbSnsId}" /> <c:out value="${snsList.regDd}" /> 연결완료 <input type="button" name="unlinkBtn" onclick=snsUnlink("<c:out value="${snsList.mbSnsId}" />"); value="연결해제"></a>
<br>
</c:forEach>
<br>
<p1>가입된 문화원 </p1><br>
<c:forEach var="centerList" items="${centerList}" varStatus="status">
<a id="<c:out value="c${centerList.mbSiteId}" />"><c:out value="${centerList.joinCouncilNm}" /><c:out value="${centerList.joinAgreeDd }" /> 가입완료 <c:if test="${centerList.masterYn ne 'Y'}"><input type="button" onclick=centerUnlink("<c:out value="${centerList.mbSiteId}" />"); value="가입해제"></c:if></a>
<br>
</c:forEach>
<p1>비밀번호 변경 </p1>
<form id="passwordForm" name="passwordForm" method="post" onsubmit="return changePassword()" >
<table>
<tr>
<td>
<input type="password" id="password" name="password"
placeholder="기존 비밀번호" required>
</td>
</tr>
<tr>
<td>
<input type="password" id="newPassword" name="newPassword" minlength="8" maxlength="16"
oninvalid="this.setCustomValidity('8~16자 영문 대 소문자, 숫자, 특수문자를 사용하세요.')"
oninput="this.setCustomValidity('')"
pattern="^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[$@$!%*#?&])[A-Za-z\d$@$!%*#?&]{8,16}$"
placeholder="새 비밀번호" required>
</td>
</tr>
<tr>
<td>
<input type="password" id="newPasswordConfirm" name="newPasswordConfirm" placeholder="새 비밀번호 확인" minlength="8" maxlength="16" required>
</td>
<td> <div id="passwordMsg"></div></td>
</tr>
</table>
<input type="submit" value="변경하기"/>
<input type="button" value="취소"/>
</div> </div>
</body> </body>
<script src="//t1.daumcdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js"></script>
<script>
function sample6_execDaumPostcode() {
new daum.Postcode({
oncomplete: function(data) {
// 팝업에서 검색결과 항목을 클릭했을때 실행할 코드를 작성하는 부분.
// 각 주소의 노출 규칙에 따라 주소를 조합한다.
// 내려오는 변수가 값이 없는 경우엔 공백('')값을 가지므로, 이를 참고하여 분기 한다.
var addr = ''; // 주소 변수
var extraAddr = ''; // 참고항목 변수
//사용자가 선택한 주소 타입에 따라 해당 주소 값을 가져온다.
if (data.userSelectedType === 'R') { // 사용자가 도로명 주소를 선택했을 경우
addr = data.roadAddress;
} else { // 사용자가 지번 주소를 선택했을 경우(J)
addr = data.jibunAddress;
}
// 우편번호와 주소 정보를 해당 필드에 넣는다.
document.getElementById('zipCode').value = data.zonecode;
document.getElementById("address").value = addr;
// 커서를 상세주소 필드로 이동한다.
document.getElementById("addressDetail").focus();
}
}).open();
}
</script>
</html> </html>

View File

@ -51,7 +51,7 @@ function goPutMyInfo(){
<body> <body>
<h2>비밀번호를 입력해주세요</h2> <h2>비밀번호를 입력해주세요</h2>
<form id="pwInputForm" name="pwInputForm" method="POST"> <form id="pwInputForm" name="pwInputForm" method="POST">
<input type="password" id="userPwd" name="userPwd"><button style="text-align:left;" class="btn-warning" onclick="goPutMyInfo();">확인</button> <input type="password" id="password" name="password" required><button style="text-align:left;" class="btn-warning" onclick="goPutMyInfo();">확인</button>
</form> </form>
</body> </body>
</html> </html>