From 9e942931dc8c66b027cd443a283034f782b15da8 Mon Sep 17 00:00:00 2001
From: JSYOO
Date: Mon, 23 Aug 2021 16:23:33 +0900
Subject: [PATCH] =?UTF-8?q?=EB=B9=84=EB=B0=80=EB=B2=88=ED=98=B8=20?=
=?UTF-8?q?=EC=B4=88=EA=B8=B0=ED=99=94,=20HTML=20=EC=9D=BD=EC=96=B4?=
=?UTF-8?q?=EC=99=80=20=EC=9D=B4=EB=A9=94=EC=9D=BC=EC=A0=84=EC=86=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.classpath | 77 +++--
src/main/java/nlib/mail/EmailSender.java | 37 +++
src/main/java/nlib/mail/service/EmailVO.java | 35 +++
.../java/nlib/user/service/MemberService.java | 8 +-
.../nlib/user/service/UserInfoService.java | 27 ++
.../nlib/user/service/impl/MemberDAO.java | 46 +--
.../user/service/impl/MemberServiceImpl.java | 148 +++++++++-
.../nlib/user/service/impl/UserInfoDAO.java | 12 +
.../service/impl/UserInfoServiceImpl.java | 29 ++
.../java/nlib/user/web/MemberController.java | 193 ++++++++-----
.../nlib/user/web/UserInfoController.java | 112 ++++++++
.../nlib/user/web/userInfoController.java | 77 -----
.../mapper/nlib/user/USER_MEMBER_SQL.xml | 45 +++
.../mapper/nlib/user/USER_USERINFO_SQL.xml | 58 ++++
.../egovframework/spring/context-mail.xml | 23 ++
src/main/resources/nlib/nlib.properties | 7 +
.../WEB-INF/jsp/nlib/login/loginForm.jsp | 6 +-
.../jsp/nlib/member/initPasswordForm.jsp | 71 +++++
.../jsp/nlib/member/insertMemberInfoForm.jsp | 155 ++++++----
.../WEB-INF/jsp/nlib/member/searchIdForm.jsp | 76 -----
.../jsp/nlib/member/searchIdResult.jsp | 37 ---
.../nlib/member/selectMemberJoiningInfo.jsp | 2 +-
.../WEB-INF/jsp/nlib/popup/jusoPopup.jsp | 2 +-
.../WEB-INF/jsp/nlib/userInfo/putMyInfo.jsp | 268 +++++++++++++++---
.../jsp/nlib/userInfo/pwCertMyInfo.jsp | 7 +-
src/main/webapp/WEB-INF/tiles/inc/menu.jsp | 2 +-
src/main/webapp/mail/pwd_mail_template.html | 12 +
27 files changed, 1132 insertions(+), 440 deletions(-)
create mode 100644 src/main/java/nlib/mail/EmailSender.java
create mode 100644 src/main/java/nlib/mail/service/EmailVO.java
create mode 100644 src/main/java/nlib/user/service/UserInfoService.java
create mode 100644 src/main/java/nlib/user/service/impl/UserInfoDAO.java
create mode 100644 src/main/java/nlib/user/service/impl/UserInfoServiceImpl.java
create mode 100644 src/main/java/nlib/user/web/UserInfoController.java
delete mode 100644 src/main/java/nlib/user/web/userInfoController.java
create mode 100644 src/main/resources/egovframework/mapper/nlib/user/USER_MEMBER_SQL.xml
create mode 100644 src/main/resources/egovframework/mapper/nlib/user/USER_USERINFO_SQL.xml
create mode 100644 src/main/resources/egovframework/spring/context-mail.xml
create mode 100644 src/main/webapp/WEB-INF/jsp/nlib/member/initPasswordForm.jsp
delete mode 100644 src/main/webapp/WEB-INF/jsp/nlib/member/searchIdForm.jsp
delete mode 100644 src/main/webapp/WEB-INF/jsp/nlib/member/searchIdResult.jsp
create mode 100644 src/main/webapp/mail/pwd_mail_template.html
diff --git a/.classpath b/.classpath
index 99a4add8..17b99a85 100644
--- a/.classpath
+++ b/.classpath
@@ -1,39 +1,38 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/nlib/mail/EmailSender.java b/src/main/java/nlib/mail/EmailSender.java
new file mode 100644
index 00000000..bbfbcbc3
--- /dev/null
+++ b/src/main/java/nlib/mail/EmailSender.java
@@ -0,0 +1,37 @@
+package nlib.mail;
+
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeMessage.RecipientType;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.mail.javamail.JavaMailSender;
+import org.springframework.mail.javamail.MimeMessageHelper;
+import org.springframework.stereotype.Component;
+
+import nlib.mail.service.EmailVO;
+
+
+@Component
+public class EmailSender {
+
+ @Autowired
+ protected JavaMailSender mailSender;
+
+ public void SendEmail(EmailVO email) throws Exception {
+ MimeMessage msg = mailSender.createMimeMessage();
+ MimeMessageHelper helper = new MimeMessageHelper(msg, true, "utf-8");
+ helper.setText(email.getContent(), true); //***HTML 적용
+ helper.setTo(email.getReciver());
+ helper.setSubject(email.getSubject());
+ helper.setFrom("siasia0824@gmail.com");
+
+
+ /* msg.setSubject(email.getSubject());
+ msg.setText(email.getContent(),"text/html");
+ msg.setText
+ msg.setRecipient(RecipientType.TO , new InternetAddress(email.getReciver()));
+ */
+ mailSender.send(msg);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/nlib/mail/service/EmailVO.java b/src/main/java/nlib/mail/service/EmailVO.java
new file mode 100644
index 00000000..f4a05ddc
--- /dev/null
+++ b/src/main/java/nlib/mail/service/EmailVO.java
@@ -0,0 +1,35 @@
+package nlib.mail.service;
+
+public class EmailVO {
+
+ private String subject;
+ private String content;
+ private String regdate;
+ private String reciver;
+
+ public String getReciver() {
+ return reciver;
+ }
+ public void setReciver(String reciver) {
+ this.reciver = reciver;
+ }
+
+ public String getSubject() {
+ return subject;
+ }
+ public void setSubject(String subject) {
+ this.subject = subject;
+ }
+ public String getContent() {
+ return content;
+ }
+ public void setContent(String content) {
+ this.content = content;
+ }
+ public String getRegdate() {
+ return regdate;
+ }
+ public void setRegdate(String regdate) {
+ this.regdate = regdate;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/nlib/user/service/MemberService.java b/src/main/java/nlib/user/service/MemberService.java
index d69abb0d..8ad5f2a9 100644
--- a/src/main/java/nlib/user/service/MemberService.java
+++ b/src/main/java/nlib/user/service/MemberService.java
@@ -27,7 +27,7 @@ public interface MemberService
public DataApiResVO certificateMember(DataApiReqVO reqVO);
- public DataApiResVO insertMemberInfo(DataApiReqVO reqVO);
+ public void insertMemberInfo(NlibLoginVO vo) throws Exception;
public DataApiResVO sendEmailForMemberJoining(DataApiReqVO reqVO);
@@ -35,7 +35,7 @@ public interface MemberService
public DataApiResVO initPassword(DataApiReqVO reqVO);
- public DataApiResVO changePassword(DataApiReqVO reqVO);
+ public void changePassword(NlibLoginVO vo) throws Exception;
public DataApiResVO selectMemberInfo(DataApiReqVO reqVO);
@@ -43,5 +43,9 @@ public interface MemberService
public DataApiResVO leaveMember(DataApiReqVO reqVO);
+ public String numberGen(int i, int j);
+
+ public String createInitPwd();
+
}
\ No newline at end of file
diff --git a/src/main/java/nlib/user/service/UserInfoService.java b/src/main/java/nlib/user/service/UserInfoService.java
new file mode 100644
index 00000000..3727eb57
--- /dev/null
+++ b/src/main/java/nlib/user/service/UserInfoService.java
@@ -0,0 +1,27 @@
+
+package nlib.user.service;
+
+
+/**
+ * Description :
+ * @author
+ * @since
+ * @version
+ * @see
+ *
+ *
+ * << Modification Information >>
+ *
+ * Date Modifier Expression
+ * ------- -------- ---------------------------
+ *
+ *
+ *
+ *
+ */
+public interface UserInfoService
+{
+ public NlibLoginVO selectMyInfo(NlibLoginVO vo) throws Exception;
+
+ public void updateMyInfo(NlibLoginVO vo) throws Exception;
+}
\ No newline at end of file
diff --git a/src/main/java/nlib/user/service/impl/MemberDAO.java b/src/main/java/nlib/user/service/impl/MemberDAO.java
index 113643d5..e8ed0fb9 100644
--- a/src/main/java/nlib/user/service/impl/MemberDAO.java
+++ b/src/main/java/nlib/user/service/impl/MemberDAO.java
@@ -3,51 +3,33 @@ package nlib.user.service.impl;
import org.springframework.stereotype.Repository;
+import egovframework.rte.psl.dataaccess.mapper.Mapper;
import nlib.restful.service.DataApiReqVO;
import nlib.restful.service.DataApiResVO;
+import nlib.user.service.NlibLoginVO;
-@Repository("memberDAO")
-public class MemberDAO
+@Mapper("memberDAO")
+public interface MemberDAO
{
- public DataApiResVO selectMemberJoiningInfo(DataApiReqVO reqVO) {
- return null;
- }
+ public DataApiResVO selectMemberJoiningInfo(DataApiReqVO reqVO) throws Exception;
- public DataApiResVO certificateMember(DataApiReqVO reqVO) {
- return null;
- }
+ public DataApiResVO certificateMember(DataApiReqVO reqVO) throws Exception;
- public DataApiResVO insertMemberInfo(DataApiReqVO reqVO) {
- return null;
- }
+ public void insertMemberInfo(NlibLoginVO vo) throws Exception;
- public DataApiResVO sendEmailForMemberJoining(DataApiReqVO reqVO) {
- return null;
- }
+ public DataApiResVO sendEmailForMemberJoining(DataApiReqVO reqVO) throws Exception;
- public DataApiResVO searchId(DataApiReqVO reqVO) {
- return null;
- }
+ public DataApiResVO searchId(DataApiReqVO reqVO) throws Exception;
- public DataApiResVO initPassword(DataApiReqVO reqVO) {
- return null;
- }
+ public DataApiResVO initPassword(DataApiReqVO reqVO) throws Exception;
- public DataApiResVO changePassword(DataApiReqVO reqVO) {
- return null;
- }
+ public void changePassword(NlibLoginVO vo) throws Exception;
- public DataApiResVO selectMemberInfo(DataApiReqVO reqVO) {
- return null;
- }
+ public DataApiResVO selectMemberInfo(DataApiReqVO reqVO) throws Exception;
- public DataApiResVO updateMemberInfo(DataApiReqVO reqVO) {
- return null;
- }
+ public DataApiResVO updateMemberInfo(DataApiReqVO reqVO) throws Exception;
- public DataApiResVO leaveMember(DataApiReqVO reqVO) {
- return null;
- }
+ public DataApiResVO leaveMember(DataApiReqVO reqVO) throws Exception;
}
\ No newline at end of file
diff --git a/src/main/java/nlib/user/service/impl/MemberServiceImpl.java b/src/main/java/nlib/user/service/impl/MemberServiceImpl.java
index 8fa900b7..8ebd61a0 100644
--- a/src/main/java/nlib/user/service/impl/MemberServiceImpl.java
+++ b/src/main/java/nlib/user/service/impl/MemberServiceImpl.java
@@ -1,16 +1,30 @@
package nlib.user.service.impl;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Random;
+
+import javax.annotation.Resource;
+
import org.springframework.stereotype.Service;
+import egovframework.rte.fdl.cryptography.EgovPasswordEncoder;
import nlib.restful.service.DataApiReqVO;
import nlib.restful.service.DataApiResVO;
import nlib.user.service.MemberService;
+import nlib.user.service.NlibLoginVO;
@Service("memberService")
public class MemberServiceImpl implements MemberService
{
+ @Resource(name="memberDAO")
private MemberDAO memberDAO;
+
+ @Resource(name = "egovEnvPasswordEncoderService")
+ EgovPasswordEncoder egovPasswordEncoder;
+
public DataApiResVO selectMemberJoiningInfo(DataApiReqVO reqVO) {
@@ -21,10 +35,13 @@ public class MemberServiceImpl implements MemberService
return null;
}
- public DataApiResVO insertMemberInfo(DataApiReqVO reqVO) {
- return null;
+ public void insertMemberInfo(NlibLoginVO vo) throws Exception {
+ String encodedText=null;
+ encodedText = egovPasswordEncoder.encryptPassword(vo.getUserPwd());
+ vo.setUserPwd(encodedText);
+ memberDAO.insertMemberInfo(vo);
}
-
+
public DataApiResVO sendEmailForMemberJoining(DataApiReqVO reqVO) {
return null;
}
@@ -37,8 +54,8 @@ public class MemberServiceImpl implements MemberService
return null;
}
- public DataApiResVO changePassword(DataApiReqVO reqVO) {
- return null;
+ public void changePassword(NlibLoginVO vo) throws Exception {
+ memberDAO.changePassword(vo);
}
public DataApiResVO selectMemberInfo(DataApiReqVO reqVO) {
@@ -53,5 +70,126 @@ public class MemberServiceImpl implements MemberService
return null;
}
+ //핸드폰 인증번호 난수 생성
+ /**
+ * 전달된 파라미터에 맞게 난수를 생성한다
+ * @param len : 생성할 난수의 길이
+ * @param dupCd : 중복 허용 여부 (1: 중복허용, 2:중복제거)
+ *
+ */
+ public String numberGen(int len, int dupCd ) {
+
+ Random rand = new Random();
+ String numStr = ""; //난수가 저장될 변수
+
+ for(int i=0;i dummylist=new ArrayList();
+
+ // 대문자사용 1
+ int useU = 1;
+ String upperStr="";
+
+ // 소문자 사용 1
+ int useL = 1;
+ String lowerStr="";
+
+ // 숫자 사용 1
+ int useN = 1;
+ String ranNumberStr="";
+
+ // 특수문자 사용 1
+ int useS = 1;
+ String ranSkeyStr="";
+
+ // 사용할 특수문자
+ String specialKey="!=#$+@%*";
+
+ // 제외시킬 대,소문자(비슷하게 생긴것들)
+ String exceptionKey="IOiol";
+
+ char upperChar;
+ char lowerChar;
+ char ranSkey;
+ int startSkey;
+ int ranNumber;
+ int whileNum = 0;
+ boolean whileFlag = true;
+
+ do {
+ int loopNum=(int)(Math.random()*4);
+ // 대문자생성
+ if((whileFlag && upperStr.equals("1")) || (!whileFlag && useU == 1 && loopNum == 0)){
+ do {
+ upperChar = (char)(Math.random() * 26 + 65);
+ upperStr=String.valueOf(upperChar);
+ } while (exceptionKey.indexOf(upperStr)!=-1);
+ dummylist.add(upperStr);
+ whileNum++;
+ }
+
+ // 소문자생성
+ if((whileFlag && lowerStr.equals("1")) || (!whileFlag && useL == 1 && loopNum == 1)){
+ do {
+ lowerChar = (char)(Math.random() * 26 + 97);
+ lowerStr=String.valueOf(lowerChar);
+ } while (exceptionKey.indexOf(lowerStr)!=-1);
+ dummylist.add(lowerStr);
+ whileNum++;
+ }
+
+ // 숫자생성(숫자 0,1 제외)
+ if((whileFlag && ranNumberStr.equals("1")) || (!whileFlag && useN == 1 && loopNum == 2)){
+ ranNumber=(int)(Math.random() * 8 + 2);
+ ranNumberStr=String.valueOf(ranNumber);
+ dummylist.add(ranNumberStr);
+ whileNum++;
+ }
+
+ // 특수문자생성
+ if((whileFlag && ranSkeyStr.equals("1")) || (!whileFlag && useS == 1 && loopNum == 3)){
+ startSkey=(int)(Math.random()* (specialKey.length()-1))+1;
+ ranSkey=specialKey.charAt(startSkey);
+ ranSkeyStr=String.valueOf(ranSkey);
+ dummylist.add(ranSkeyStr);
+ whileNum++;
+ }
+ whileFlag = false;
+ } while (whileNum
@@ -84,12 +90,19 @@ import nlib.user.service.NlibLoginVO;
@Controller
public class MemberController {
+
+ @Resource(name="userInfoService")
+ private UserInfoService userInfoService;
+
@Resource(name="memberService")
private MemberService memberService;
@Resource(name="informService")
private InformService informService;
+ @Resource(name = "egovEnvPasswordEncoderService")
+ EgovPasswordEncoder egovPasswordEncoder;
+
/* NaverLoginBO */
private NaverLoginBO naverLoginBO;
private String apiResult = null;
@@ -99,11 +112,17 @@ public class MemberController {
this.naverLoginBO = naverLoginBO;
}
+ @Autowired
+ private EmailSender emailSender;
+
/* 이메일 메시지 및 템플릿 정보 */
//템플릿 파일경로
@Value("#{properties['mailing.sender.membership.template']}")
private String template;
+ @Value("#{properties['mailing.sender.membership.pwdTemplate']}")
+ private String pwdTemplate;
+
//보내는 사람 이메일주소
@Value("#{properties['mailing.sender.membership.email']}")
private String senderAddr;
@@ -112,6 +131,11 @@ public class MemberController {
@Value("#{properties['mailing.sender.membership.name']}")
private String senderName;
+ //게스트 USERID
+ @Value("#{properties['guest.userid']}")
+ private String gUserId;
+
+
public ModelMap certificateMember(HttpServletRequest req) {
return null;
}
@@ -167,28 +191,32 @@ public class MemberController {
model.addAttribute("kakaoUrl", kakaoUrl);
return "nlib/member/snsCertForm";
}
-
+ /**
+ * 회원가입 폼
+ * @exception Exception
+ */
@RequestMapping(value="/member/insertMemberInfoForm.do")
public String insertMemberInfoForm(HttpServletRequest request,NlibLoginVO vo,HttpSession session,ModelMap model ) throws Exception{
Map flashMap =RequestContextUtils.getInputFlashMap(request);
- if(flashMap != null)
+ /*if(flashMap != null)
{
vo.setLoginUserId(String.valueOf(flashMap.get("email")));
}else {
return "forward:/member/selectMemberJoiningInfo.do";
- }
+ }*/
model.addAttribute("loginVO",vo);
return "nlib/member/insertMemberInfoForm";
}
+ /**
+ * 회원가입
+ * @exception Exception
+ */
@RequestMapping(value="/member/insertMemberInfo.do")
- public String insertMemberInfo(@RequestParam HashMap commandMap ) throws Exception{
- DataApiReqVO reqVO = new DataApiReqVO();
- reqVO.setInfo(commandMap);
-
- // 통합시스템에 등록처리 요청 (data insert)
-
+ public String insertMemberInfo(NlibLoginVO vo) throws Exception{
+ //등록처리 요청 (data insert)
+ memberService.insertMemberInfo(vo);
// 결과가 정상이면, 안내 메일 발송
// > 템플릿파일에서 내용 mailing.sender.membership.template
@@ -207,7 +235,8 @@ public class MemberController {
for(String readLine : list) {
contents+=readLine;
}
- contents=contents.replaceAll("[$]\\{userName\\}","유종선");
+ /*contents=contents.replaceAll("[$]\\{userName\\}","유종선");*/
+ contents=contents.replace("${userName}","유종선");
System.out.println(contents);
return "nlib/member/insertMemberInfoResult";
}
@@ -218,19 +247,19 @@ public class MemberController {
*/
@RequestMapping(value="/member/phoneCertNum.ajax" , method=RequestMethod.POST)
public @ResponseBody void phoneCertNum(HttpServletResponse response,HttpServletRequest request) throws Exception{
- String phone = request.getParameter("phone");
+ String telNo = request.getParameter("telNo");
HashMap commandMap = new HashMap();
DataApiReqVO reqVO = new DataApiReqVO();
- //인증번호
- String CertNumber=numberGen(6,1);
+ //인증번호 생성
+ String CertNumber=memberService.numberGen(6,1);
commandMap.put("CertNumber",CertNumber);
reqVO.setInfo(commandMap);
- System.out.println(phone);
+ System.out.println(telNo);
System.out.println(CertNumber);
}
@@ -257,68 +286,80 @@ public class MemberController {
return "true";
}
- /**
- * 전달된 파라미터에 맞게 난수를 생성한다
- * @param len : 생성할 난수의 길이
- * @param dupCd : 중복 허용 여부 (1: 중복허용, 2:중복제거)
- *
- */
- public static String numberGen(int len, int dupCd ) {
-
- Random rand = new Random();
- String numStr = ""; //난수가 저장될 변수
-
- for(int i=0;i naver nate 등등
+ String subject = "온라인자료대출시스템 비밀번호 초기화 메일입니다.";
+
+
+ // 결과가 정상이면, 안내 메일 발송
+ // > 템플릿파일에서 내용 mailing.sender.membership.pwdtemplate
+ // > 치환 (사용자명, 이메일주소)
+ // > 발송처리 요청
+ Path path = Paths.get(pwdTemplate);
+ Charset cs = StandardCharsets.UTF_8;
+ List list = new ArrayList();
+ String contents = "";
+ try {
+ list = Files.readAllLines(path,cs);
+ }catch(IOException e) {
+ e.printStackTrace();
+ }
+
+ for(String readLine : list) {
+ contents+=readLine;
+ }
+ contents=contents.replace("${userPwd}",InitPwd);
+
+ email.setReciver(reciver);
+
+ email.setSubject(subject);
+ email.setContent(contents);
+ emailSender.SendEmail(email);
+
+ encodedText = egovPasswordEncoder.encryptPassword(InitPwd);
+ vo.setUserPwd(encodedText);
+
+ vo.setUserId(gUserId);
+
+ //암호화된 비밀번호로 수정
+ memberService.changePassword(vo);
+
+ message="초기화된 비밀번호가 이메일로 발송됐습니다.";
+ }else {
+ message="일치하는 아이디가 없습니다.";
+ }
+
+ return message;
}
/**
@@ -382,7 +423,7 @@ public class MemberController {
// Token Request
GoogleOAuthResponse result = mapper.readValue(resultEntity.getBody(), new TypeReference() {
});
-
+
// ID Token만 추출 (사용자의 정보는 jwt로 인코딩 되어있다)
String jwtToken = result.getIdToken();
String requestUrl = UriComponentsBuilder.fromHttpUrl("https://oauth2.googleapis.com/tokeninfo")
@@ -443,4 +484,20 @@ public class MemberController {
rttr.addFlashAttribute("email",kemail);
return "redirect:/member/insertMemberInfoForm.do";
}// end kakaoLogin()
+
+ /**
+ * 주소검색 팝업
+ * @param request
+ * @param response
+ * @param session
+ * @return
+ * @throws Exception
+ */
+ @RequestMapping(value = "/popup/jusoPopup.do")
+ public String jusoPopup(HttpServletRequest request, HttpServletResponse response, HttpSession session)
+ throws Exception {
+
+ return "nlib/popup/jusoPopup";
+ }// end kakaoLogin()
+
}
\ No newline at end of file
diff --git a/src/main/java/nlib/user/web/UserInfoController.java b/src/main/java/nlib/user/web/UserInfoController.java
new file mode 100644
index 00000000..34e6adb0
--- /dev/null
+++ b/src/main/java/nlib/user/web/UserInfoController.java
@@ -0,0 +1,112 @@
+
+package nlib.user.web;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.springframework.security.core.Authentication;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import egovframework.rte.fdl.cryptography.EgovPasswordEncoder;
+import nlib.restful.service.DataApiReqVO;
+import nlib.security.SecUserVO;
+import nlib.user.service.MemberService;
+import nlib.user.service.NlibLoginVO;
+import nlib.user.service.UserInfoService;
+
+
+/**
+ *
+ * @Class Name : userInfoController.java
+ *
+ * @Description : 회원 정보 controller
+ *
+ *
+ * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
+ *
+ *
+ *
+ * @ ------------ -------- ---------------------------
+ * @ 수정일 수정자 수정내용
+ * @ ------------ -------- ---------------------------
+ * @ 2021. 7. 14. JSYOO 최초 생성
+ *
+ *
+ * @author 이씨플라자 * DIGITALSHIP JSYOO
+ * @since 2021. 7. 14.
+ * @version 1.0
+ *
+ */
+@Controller
+public class UserInfoController {
+
+ @Resource(name="userInfoService")
+ private UserInfoService userInfoService;
+
+ @Resource(name = "egovEnvPasswordEncoderService")
+ EgovPasswordEncoder egovPasswordEncoder;
+
+ /**
+ * 내 정보 조회
+ * @exception Exception
+ */
+ @RequestMapping(value="/userInfo/getMyInfo.do")
+ public String getMyInfo(HttpServletResponse response,HttpServletRequest request) throws Exception{
+ return "nlib/userInfo/getMyInfo";
+ }
+
+ /**
+ * 내 정보 수정 페이지
+ * @exception Exception
+ */
+ @RequestMapping(value="/userInfo/putMyInfo.do")
+ public String putMyInfo(NlibLoginVO vo,HttpServletResponse response,HttpServletRequest request,Authentication authentication,ModelMap model) throws Exception{
+ NlibLoginVO loginVO =userInfoService.selectMyInfo(vo);
+
+ String encodedText=null;
+ encodedText = egovPasswordEncoder.encryptPassword(vo.getUserPwd());
+ vo.setUserPwd(encodedText);
+
+ //암호화된 패스워드 비교
+ if(loginVO.getUserPwd().equals(vo.getUserPwd())) {
+ model.addAttribute("loginVO",loginVO);
+ return "nlib/userInfo/putMyInfo";
+ }else {
+ String message="비밀번호가 잘못되었습니다.";
+ model.addAttribute("message",message);
+ return "nlib/userInfo/pwCertMyInfo";
+ }
+ }
+
+ /**
+ * 내 정보 수정
+ * @return
+ * @exception Exception
+ */
+ @RequestMapping(value="/userInfo/updateMyInfo.ajax" , method=RequestMethod.POST)
+ public @ResponseBody void updateMyInfo(NlibLoginVO vo,HttpServletResponse response,HttpServletRequest request) throws Exception{
+
+ String encodedText=null;
+ encodedText = egovPasswordEncoder.encryptPassword(vo.getUserPwd());
+ vo.setUserPwd(encodedText);
+
+ userInfoService.updateMyInfo(vo);
+ }
+ /**
+ * 내 정보 수정 전 password 인증
+ * @exception Exception
+ */
+ @RequestMapping(value="/userInfo/pwCertMyInfo.do")
+ public String pwCertMyInfo(HttpServletResponse response,HttpServletRequest request) throws Exception{
+
+ return "nlib/userInfo/pwCertMyInfo";
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/nlib/user/web/userInfoController.java b/src/main/java/nlib/user/web/userInfoController.java
deleted file mode 100644
index aba95454..00000000
--- a/src/main/java/nlib/user/web/userInfoController.java
+++ /dev/null
@@ -1,77 +0,0 @@
-
-package nlib.user.web;
-
-import java.util.HashMap;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.springframework.security.core.Authentication;
-import org.springframework.stereotype.Controller;
-import org.springframework.ui.ModelMap;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-import nlib.restful.service.DataApiReqVO;
-import nlib.security.SecUserVO;
-
-
-/**
- *
- * @Class Name : userInfoController.java
- *
- * @Description : 회원 정보 controller
- *
- *
- * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
- *
- *
- *
- * @ ------------ -------- ---------------------------
- * @ 수정일 수정자 수정내용
- * @ ------------ -------- ---------------------------
- * @ 2021. 7. 14. JSYOO 최초 생성
- *
- *
- * @author 이씨플라자 * DIGITALSHIP JSYOO
- * @since 2021. 7. 14.
- * @version 1.0
- *
- */
-@Controller
-public class userInfoController {
- /**
- * 내 정보 조회
- * @exception Exception
- */
- @RequestMapping(value="/userInfo/getMyInfo.do")
- public String getMyInfo(HttpServletResponse response,HttpServletRequest request) throws Exception{
- return "nlib/userInfo/getMyInfo";
- }
-
- /**
- * 내 정보 수정
- * @exception Exception
- */
- @RequestMapping(value="/userInfo/putMyInfo.do")
- public String putMyInfo(HttpServletResponse response,HttpServletRequest request,Authentication authentication,ModelMap model) throws Exception{
- SecUserVO vo=(SecUserVO) authentication.getPrincipal();
-
- HashMap map = new HashMap();
- map.put("id", vo.getUserId());
-
- //회원 ID로 회원의 정보를 조회해온다.
- DataApiReqVO reqvo=new DataApiReqVO();
- reqvo.setInfo(map);
-
- model.addAttribute("result",vo);
- return "nlib/userInfo/putMyInfo";
- }
- /**
- * 내 정보 수정 전 password 인증
- * @exception Exception
- */
- @RequestMapping(value="/userInfo/pwCertMyInfo.do")
- public String pwCertMyInfo(HttpServletResponse response,HttpServletRequest request) throws Exception{
- return "nlib/userInfo/pwCertMyInfo";
- }
-}
\ No newline at end of file
diff --git a/src/main/resources/egovframework/mapper/nlib/user/USER_MEMBER_SQL.xml b/src/main/resources/egovframework/mapper/nlib/user/USER_MEMBER_SQL.xml
new file mode 100644
index 00000000..6841f412
--- /dev/null
+++ b/src/main/resources/egovframework/mapper/nlib/user/USER_MEMBER_SQL.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ SELECT CONCAT(LEFT(MAX(USER_ID),2),
+ LPAD(RIGHT(MAX(USER_ID),9)+1,9,0)) FROM TMP_SM_USER;
+
+ INSERT INTO
+ TMP_SM_USER
+ (USER_ID,LOGIN_USER_ID,USER_DIV,USER_NM,USER_PWD,BIRTHDATE,GENDER,TEL_NO,ZIPCODE,ADDR1,ADDR2,REG_ID,MOD_ID)
+ VALUES
+ (#{userId},#{loginUserId},'N',#{userNm},#{userPwd},#{birthdate},#{gender},#{telNo},#{zipcode},#{addr1},#{addr2},#{userId},#{userId})
+
+
+ UPDATE
+ TMP_SM_USER
+ SET
+ USER_PWD=#{userPwd}
+ ,MOD_ID = #{userId}
+ ,MOD_DD = SYSDATE()
+
+ WHERE 1=1
+ AND LOGIN_USER_ID = #{loginUserId}
+ AND TEL_NO = #{telNo}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/egovframework/mapper/nlib/user/USER_USERINFO_SQL.xml b/src/main/resources/egovframework/mapper/nlib/user/USER_USERINFO_SQL.xml
new file mode 100644
index 00000000..3c7ae867
--- /dev/null
+++ b/src/main/resources/egovframework/mapper/nlib/user/USER_USERINFO_SQL.xml
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ UPDATE
+ TMP_SM_USER
+ SET
+ USER_NM=#{userNm}
+ ,USER_PWD=#{userPwd}
+ ,BIRTHDATE=#{birthdate}
+ ,GENDER=#{gender}
+ ,TEL_NO=#{telNo}
+ ,ZIPCODE=#{zipcode}
+ ,ADDR1=#{addr1}
+ ,ADDR2=#{addr2}
+ WHERE 1=1
+ AND USER_ID="U2000000003"
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/egovframework/spring/context-mail.xml b/src/main/resources/egovframework/spring/context-mail.xml
new file mode 100644
index 00000000..d60df14e
--- /dev/null
+++ b/src/main/resources/egovframework/spring/context-mail.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+ true
+ true
+ true
+ smtp.gmail.com
+ TLSv1.2
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/nlib/nlib.properties b/src/main/resources/nlib/nlib.properties
index 0062fe1f..cb6038af 100644
--- a/src/main/resources/nlib/nlib.properties
+++ b/src/main/resources/nlib/nlib.properties
@@ -55,6 +55,8 @@ fileupload.bbs.qna.subpath = /bbs/qna
# \uba54\uc77c \uacbd\ub85c
mailing.sender.membership.template = C:/iams/workspace/nlib/src/main/webapp/mail/mail_template.html
+mailing.sender.membership.pwdTemplate = C:/iams/workspace/nlib/src/main/webapp/mail/pwd_mail_template.html
+
#\uba54\uc77c \ubcf4\ub0b4\ub294 \uc8fc\uc18c
mailing.sender.membership.email = no-reply@nlib.org
@@ -91,3 +93,8 @@ oauth2.client.provider.naver.token-uri = https://nid.naver.com/oauth2.0/token
oauth2.client.provider.naver.user-info-uri = https://openapi.naver.com/v1/nid/me
oauth2.client.provider.naver.user-name-attribute = response
+
+#----------------------------------------
+# \uc190\ub2d8\uc815\ubcf4
+#----------------------------------------
+guest.userid = GUEST
diff --git a/src/main/webapp/WEB-INF/jsp/nlib/login/loginForm.jsp b/src/main/webapp/WEB-INF/jsp/nlib/login/loginForm.jsp
index 5cfc396e..6790ee2e 100644
--- a/src/main/webapp/WEB-INF/jsp/nlib/login/loginForm.jsp
+++ b/src/main/webapp/WEB-INF/jsp/nlib/login/loginForm.jsp
@@ -40,10 +40,10 @@
@@ -57,7 +57,7 @@
-
+
+
+
diff --git a/src/main/webapp/WEB-INF/jsp/nlib/member/initPasswordForm.jsp b/src/main/webapp/WEB-INF/jsp/nlib/member/initPasswordForm.jsp
new file mode 100644
index 00000000..39571980
--- /dev/null
+++ b/src/main/webapp/WEB-INF/jsp/nlib/member/initPasswordForm.jsp
@@ -0,0 +1,71 @@
+<%
+/**
+ *
+ *
+ * @ ------------ -------- ---------------------------
+ * @ 수정일 수정자 수정내용
+ * @ ------------ -------- ---------------------------
+ * @ 2021. 7. 12. JSYOO 최초 생성
+ *
+ *
+ * @author 이씨플라자 * DIGITALSHIP JSYOO
+ * @since 2021. 7. 12.
+ * @version 1.0
+ *
+ */
+ %>
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+ pageEncoding="UTF-8"%>
+
+
+