비밀번호 찾기 기능 추가.
parent
4222d1e9ab
commit
a8fdf73ae6
7
pom.xml
7
pom.xml
|
|
@ -200,7 +200,12 @@
|
|||
<artifactId>tiles-servlet</artifactId>
|
||||
<version>${org.apache.tiles.version}</version>
|
||||
</dependency>
|
||||
<!-- /tiles -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-email</artifactId>
|
||||
<version>1.5</version>
|
||||
</dependency>
|
||||
<!-- /tiles -->
|
||||
|
||||
|
||||
<!-- GPKI인증서 로그인처리 라이브러리 -->
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
package com.mca.cmmn.mapper;
|
||||
|
||||
import com.mca.cmmn.vo.UserCertificationVO;
|
||||
import egovframework.rte.psl.dataaccess.mapper.Mapper;
|
||||
|
||||
@Mapper("userCertificationMapper")
|
||||
public interface UserCertificationMapper {
|
||||
void insertCertificationNum(UserCertificationVO certificationVO);
|
||||
|
||||
UserCertificationVO selectCertificationInfo(UserCertificationVO certificationVO);
|
||||
|
||||
void updateCertificationNumStatus(UserCertificationVO certificationVO);
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
package com.mca.cmmn.service;
|
||||
|
||||
import com.mca.cmmn.mapper.UserCertificationMapper;
|
||||
import com.mca.cmmn.vo.UserCertificationVO;
|
||||
import com.mca.user.vo.UserVO;
|
||||
import org.apache.commons.mail.EmailException;
|
||||
import org.apache.commons.mail.SimpleEmail;
|
||||
import org.springframework.mail.MailException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Random;
|
||||
|
||||
@Service("userCertificationService")
|
||||
public class UserCertificationService {
|
||||
|
||||
@Resource(name = "userCertificationMapper")
|
||||
UserCertificationMapper userCertificationMapper;
|
||||
|
||||
public String sendCertificationNumber(UserVO user) throws MailException {
|
||||
Random random = new Random(System.currentTimeMillis());
|
||||
int range = (int)Math.pow(10,6);
|
||||
int trim = (int)Math.pow(10, 6-1);
|
||||
int certificationNumber = random.nextInt(range)+trim;
|
||||
|
||||
UserCertificationVO userCertificationVO = new UserCertificationVO();
|
||||
userCertificationVO.setUserid(user.getUserid());
|
||||
userCertificationVO.setCertification_num(Integer.toString(certificationNumber));
|
||||
userCertificationVO.setExpiration_date(LocalDateTime.now().plusMinutes(5));
|
||||
userCertificationMapper.insertCertificationNum(userCertificationVO);
|
||||
|
||||
SimpleEmail email = new SimpleEmail();
|
||||
email.setCharset("euc-kr");
|
||||
email.setHostName("smtp.naver.com");
|
||||
email.setSmtpPort(587);
|
||||
email.setAuthentication("lcks0504l", "nocm509");
|
||||
try {
|
||||
email.addTo(user.getEmail(), user.getName());
|
||||
email.setFrom("lcks0504l@naver.com", "[지하공간]인증번호 발송");
|
||||
email.setSubject("[지하공간]인증번호 발송");
|
||||
email.setContent("인증번호 : "+certificationNumber, "text/plain; charset=euc-kr");
|
||||
email.send();
|
||||
} catch (EmailException e) {
|
||||
e.printStackTrace();
|
||||
return "mailError";
|
||||
}
|
||||
return "mailSend";
|
||||
}
|
||||
|
||||
public UserCertificationVO selectCertificationInfo(UserCertificationVO certificationVO) {
|
||||
return userCertificationMapper.selectCertificationInfo(certificationVO);
|
||||
}
|
||||
|
||||
public void updateCertificationNumStatus(UserCertificationVO certificationVO) {
|
||||
userCertificationMapper.updateCertificationNumStatus(certificationVO);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package com.mca.cmmn.vo;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
public class UserCertificationVO {
|
||||
|
||||
private String userid;
|
||||
private String certification_num;
|
||||
private LocalDateTime expiration_date;
|
||||
private String status;
|
||||
|
||||
public String getUserid() {
|
||||
return userid;
|
||||
}
|
||||
|
||||
public void setUserid(String userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
|
||||
public String getCertification_num() {
|
||||
return certification_num;
|
||||
}
|
||||
|
||||
public void setCertification_num(String certification_num) {
|
||||
this.certification_num = certification_num;
|
||||
}
|
||||
|
||||
public LocalDateTime getExpiration_date() {
|
||||
return expiration_date;
|
||||
}
|
||||
|
||||
public void setExpiration_date(LocalDateTime expiration_date) {
|
||||
this.expiration_date = expiration_date;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,13 @@
|
|||
package com.mca.cmmn.web;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import com.mca.cmmn.service.UserCertificationService;
|
||||
import com.mca.cmmn.vo.UserCertificationVO;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
|
@ -17,218 +20,224 @@ import egovframework.rte.fdl.property.EgovPropertyService;
|
|||
|
||||
@Controller
|
||||
public class CommonController {
|
||||
|
||||
|
||||
/**
|
||||
* properties값을 가져오는 인터페이스.
|
||||
**/
|
||||
@Resource(name="propertiesService")
|
||||
private EgovPropertyService propertiesService;
|
||||
|
||||
@Resource(name="userService")
|
||||
private UserService userService;
|
||||
|
||||
@Resource(name="areaCodeService")
|
||||
private AreaCodeService areaCodeService;
|
||||
|
||||
|
||||
/**
|
||||
* 로그인 화면을 반환한다.
|
||||
*
|
||||
* @param error 로그인 실패정보
|
||||
* @param fail 사용자 인증정보
|
||||
* @return 로그인화면 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value="/login")
|
||||
public String login(String error, String fail, Model model) throws Exception{
|
||||
try {
|
||||
if(error != null) {
|
||||
model.addAttribute("errMsg", "접속자 정보를 찾을 수 없습니다.");
|
||||
}
|
||||
if(fail != null) {
|
||||
model.addAttribute("errMsg", "승인 처리중입니다.");
|
||||
}
|
||||
return "login";
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
e.printStackTrace();
|
||||
return "error/EgovServerError";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 로그아웃처리를 한다
|
||||
*
|
||||
* @param session 세션 객체
|
||||
* @param model 모델 객체
|
||||
* @return 로그인 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value="/logout")
|
||||
public String logout(HttpSession session, Model model) throws Exception {
|
||||
try {
|
||||
session.removeAttribute("id");
|
||||
session.removeAttribute("admin");
|
||||
model.addAttribute("url", "/");
|
||||
model.addAttribute("resultMsg", "로그아웃 되었습니다.");
|
||||
return "/redirect";
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
e.printStackTrace();
|
||||
return "error/EgovServerError";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 회원가입 화면을 반환한다.
|
||||
* @return 회원가입 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value="/join")
|
||||
public String join() throws Exception {
|
||||
try {
|
||||
return "anonymous/html/join";
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
e.printStackTrace();
|
||||
return "error/EgovServerError";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 아이디 중복 체크를 한다.
|
||||
* @param checkId 입력 아이디값
|
||||
* @return 성공, 실패 여부
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value="/userIdCheck")
|
||||
@ResponseBody
|
||||
public String checkId(@RequestParam("checkId")String checkId) throws Exception {
|
||||
try {
|
||||
int cnt = userService.selectUserIdCheck(checkId);
|
||||
if(cnt > 0) {
|
||||
return "duplicate";
|
||||
}else {
|
||||
return "ok";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
e.printStackTrace();
|
||||
return "error/EgovServerError";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 사용자 등록 처리를 한다.
|
||||
* @param userVO 사용자정보 VO
|
||||
* @param model 모델 객체
|
||||
* @return 로그인 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value="/insertUser")
|
||||
public String userInsert(@ModelAttribute("userVO") UserVO userVO, Model model) throws Exception {
|
||||
try {
|
||||
int result = userService.insertUser(userVO);
|
||||
if(result == 0) {
|
||||
model.addAttribute("url", "/");
|
||||
model.addAttribute("resultMsg", "회원가입이 완료 되었습니다. 승인을 기다려주세요.");
|
||||
return "/redirect";
|
||||
}else {
|
||||
model.addAttribute("resultMsg", "오류가 발생하였습니다.");
|
||||
return null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
e.printStackTrace();
|
||||
return "error/EgovServerError";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 지역 리스트 가져온다.
|
||||
* @param code 법정동 코드
|
||||
* @param area 지역이름
|
||||
* @return 선택된 지역 리스트
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value="/selectAreaList")
|
||||
@ResponseBody
|
||||
public List<?> selectAreaList(@RequestParam("code")String code, @RequestParam("area")String area) throws Exception {
|
||||
List<?> countyList = areaCodeService.selectCounty(code, area);
|
||||
return countyList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 권한이 없는 사용자가 접근시 권한제한 화면으로 이동한다.
|
||||
*
|
||||
* @return 권한없음 페이지
|
||||
* @exception Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping("/error/EgovAccessDenied")
|
||||
public String accessDenied() throws Exception {
|
||||
return "error/EgovAccessDenied";
|
||||
|
||||
|
||||
/**
|
||||
* properties값을 가져오는 인터페이스.
|
||||
**/
|
||||
@Resource(name="propertiesService")
|
||||
private EgovPropertyService propertiesService;
|
||||
|
||||
@Resource(name="userService")
|
||||
private UserService userService;
|
||||
|
||||
@Resource(name="areaCodeService")
|
||||
private AreaCodeService areaCodeService;
|
||||
|
||||
@Resource(name="userCertificationService")
|
||||
private UserCertificationService userCertificationService;
|
||||
|
||||
|
||||
/**
|
||||
* 로그인 화면을 반환한다.
|
||||
*
|
||||
* @param error 로그인 실패정보
|
||||
* @param fail 사용자 인증정보
|
||||
* @return 로그인화면 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value="/login")
|
||||
public String login(String error, String fail, Model model) throws Exception{
|
||||
try {
|
||||
if(error != null) {
|
||||
model.addAttribute("errMsg", "접속자 정보를 찾을 수 없습니다.");
|
||||
}
|
||||
if(fail != null) {
|
||||
model.addAttribute("errMsg", "승인 처리중입니다.");
|
||||
}
|
||||
return "login";
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
e.printStackTrace();
|
||||
return "error/EgovServerError";
|
||||
}
|
||||
// 아이디 찾기 페이지 이동
|
||||
@RequestMapping(value = "findId")
|
||||
public String findIdView(){
|
||||
}
|
||||
|
||||
return "anonymous/findId";
|
||||
}
|
||||
// 아이디 찾기 실행
|
||||
/**
|
||||
* 로그아웃처리를 한다
|
||||
*
|
||||
* @param session 세션 객체
|
||||
* @param model 모델 객체
|
||||
* @return 로그인 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value="/logout")
|
||||
public String logout(HttpSession session, Model model) throws Exception {
|
||||
try {
|
||||
session.removeAttribute("id");
|
||||
session.removeAttribute("admin");
|
||||
model.addAttribute("url", "/");
|
||||
model.addAttribute("resultMsg", "로그아웃 되었습니다.");
|
||||
return "/redirect";
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
e.printStackTrace();
|
||||
return "error/EgovServerError";
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "findId", method = RequestMethod.POST)
|
||||
public String findIdAction(UserVO userVO, Model model) {
|
||||
UserVO user = userService.findId(userVO);
|
||||
/**
|
||||
* 회원가입 화면을 반환한다.
|
||||
* @return 회원가입 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value="/join")
|
||||
public String join() throws Exception {
|
||||
try {
|
||||
return "anonymous/html/join";
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
e.printStackTrace();
|
||||
return "error/EgovServerError";
|
||||
}
|
||||
}
|
||||
|
||||
if (user == null) {
|
||||
model.addAttribute("check", 1);
|
||||
} else {
|
||||
model.addAttribute("check", 2);
|
||||
model.addAttribute("id", user.getUserid());
|
||||
}
|
||||
/**
|
||||
* 아이디 중복 체크를 한다.
|
||||
* @param checkId 입력 아이디값
|
||||
* @return 성공, 실패 여부
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value="/userIdCheck")
|
||||
@ResponseBody
|
||||
public String checkId(@RequestParam("checkId")String checkId) throws Exception {
|
||||
try {
|
||||
int cnt = userService.selectUserIdCheck(checkId);
|
||||
if(cnt > 0) {
|
||||
return "duplicate";
|
||||
}else {
|
||||
return "ok";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
e.printStackTrace();
|
||||
return "error/EgovServerError";
|
||||
}
|
||||
}
|
||||
|
||||
return "anonymous/findId";
|
||||
/**
|
||||
* 사용자 등록 처리를 한다.
|
||||
* @param userVO 사용자정보 VO
|
||||
* @param model 모델 객체
|
||||
* @return 로그인 화면
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value="/insertUser")
|
||||
public String userInsert(@ModelAttribute("userVO") UserVO userVO, Model model) throws Exception {
|
||||
try {
|
||||
int result = userService.insertUser(userVO);
|
||||
if(result == 0) {
|
||||
model.addAttribute("url", "/");
|
||||
model.addAttribute("resultMsg", "회원가입이 완료 되었습니다. 승인을 기다려주세요.");
|
||||
return "/redirect";
|
||||
}else {
|
||||
model.addAttribute("resultMsg", "오류가 발생하였습니다.");
|
||||
return null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
e.printStackTrace();
|
||||
return "error/EgovServerError";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//pw찾기 페이지 이동
|
||||
@RequestMapping(value = "findPwd")
|
||||
public String findPwdView(){
|
||||
return "anonymous/findPwd";
|
||||
}
|
||||
//pw찾기 실행
|
||||
@RequestMapping(value = "findPwd", method = RequestMethod.POST)
|
||||
public String findPwdAction(UserVO userVO, Model model){
|
||||
UserVO user = userService.findPwd(userVO);
|
||||
/**
|
||||
* 지역 리스트 가져온다.
|
||||
* @param code 법정동 코드
|
||||
* @param area 지역이름
|
||||
* @return 선택된 지역 리스트
|
||||
* @throws Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping(value="/selectAreaList")
|
||||
@ResponseBody
|
||||
public List<?> selectAreaList(@RequestParam("code")String code, @RequestParam("area")String area) throws Exception {
|
||||
List<?> countyList = areaCodeService.selectCounty(code, area);
|
||||
return countyList;
|
||||
}
|
||||
|
||||
if (user == null) {
|
||||
model.addAttribute("check", 1);
|
||||
} else {
|
||||
model.addAttribute("check", 0);
|
||||
model.addAttribute("updateid", user.getUserid());
|
||||
}
|
||||
return "anonymous/findPwd";
|
||||
}
|
||||
/**
|
||||
* 권한이 없는 사용자가 접근시 권한제한 화면으로 이동한다.
|
||||
*
|
||||
* @return 권한없음 페이지
|
||||
* @exception Exception 기본 예외 처리
|
||||
*/
|
||||
@RequestMapping("/error/EgovAccessDenied")
|
||||
public String accessDenied() throws Exception {
|
||||
return "error/EgovAccessDenied";
|
||||
}
|
||||
// 아이디 찾기 페이지 이동
|
||||
@RequestMapping(value = "findId")
|
||||
public String findIdView(){
|
||||
|
||||
//pw 바꾸기 실행
|
||||
@RequestMapping(value = "updatepwd", method = RequestMethod.POST)
|
||||
public String updatePwdAction(@RequestParam(value = "updateid", defaultValue = "", required = false) String id, UserVO userVO) {
|
||||
return "anonymous/html/findId";
|
||||
}
|
||||
// 아이디 찾기 실행
|
||||
|
||||
userVO.setUserid(id);
|
||||
System.out.println(userVO);
|
||||
userService.updatePwd(userVO);
|
||||
return "anonymous/findPwdConfirm";
|
||||
}
|
||||
@RequestMapping(value = "findId", method = RequestMethod.POST)
|
||||
public String findIdAction(UserVO userVO, Model model) {
|
||||
UserVO user = userService.findId(userVO);
|
||||
|
||||
// 비밀번호 변경 성공페이지 이동
|
||||
public String CheckPwd(HttpSession session, Model model){
|
||||
UserVO loginUser = (UserVO) session.getAttribute("loginUser");
|
||||
if (user == null) {
|
||||
model.addAttribute("check", 1);
|
||||
} else {
|
||||
model.addAttribute("check", 2);
|
||||
model.addAttribute("id", user.getUserid());
|
||||
}
|
||||
|
||||
if (loginUser == null) {
|
||||
return "/login";
|
||||
} else {
|
||||
return "checkform";
|
||||
}
|
||||
}
|
||||
return "anonymous/html/findId";
|
||||
|
||||
}
|
||||
//pw찾기 페이지 이동
|
||||
@RequestMapping(value = "findPwd")
|
||||
public String findPwdView(){
|
||||
return "anonymous/html/findPwd";
|
||||
}
|
||||
|
||||
//pw찾기 인증번호 발송
|
||||
@RequestMapping(value = "sendEmail")
|
||||
@ResponseBody
|
||||
public String sendEmail(UserVO user){
|
||||
user = userService.findPwd(user);
|
||||
if(user==null){
|
||||
return "userNull";
|
||||
}else{
|
||||
return userCertificationService.sendCertificationNumber(user);
|
||||
}
|
||||
}
|
||||
//pw찾기 인증번호 확인
|
||||
@RequestMapping(value = "certifyNumCheck")
|
||||
@ResponseBody
|
||||
public String certifyNumCheck(UserCertificationVO certificationVO){
|
||||
UserCertificationVO savedInfo = userCertificationService.selectCertificationInfo(certificationVO);
|
||||
if(savedInfo==null){
|
||||
return "InfoNull";
|
||||
}else if(!savedInfo.getCertification_num().equals(certificationVO.getCertification_num())){
|
||||
return "numberNotMatch";
|
||||
}else if(savedInfo.getStatus().equals("checked")){
|
||||
return "isChecked";
|
||||
}else if(!savedInfo.getExpiration_date().isAfter(LocalDateTime.now())){
|
||||
return "expirationTimeAfter";
|
||||
}else{
|
||||
savedInfo.setStatus("checked");
|
||||
userCertificationService.updateCertificationNumStatus(savedInfo);
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
//pw찾기 비밀번호 변경
|
||||
@RequestMapping(value = "passwordUpdate", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public String passwordUpdate(UserVO userVO){
|
||||
userService.updatePwd(userVO);
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
|
|
@ -22,29 +22,22 @@ public class UserService {
|
|||
}
|
||||
|
||||
public int insertUser(UserVO userVO) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
try {
|
||||
/* bcrypt 사용 고려 */
|
||||
//BCryptPasswordEncoder bcryptPasswordEncoder = new BCryptPasswordEncoder(10);
|
||||
//userVO.setPassword(bcryptPasswordEncoder.encode(userVO.getPassword()));
|
||||
|
||||
userMapper.insertUser(userVO);
|
||||
return 0;
|
||||
|
||||
}catch (Exception e) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public UserVO selectUserInfo(String userid) {
|
||||
// TODO Auto-generated method stub
|
||||
return userMapper.selectUserInfo(userid);
|
||||
}
|
||||
|
||||
public List<?> selectUserList(UserSearchVO userSearchVO) {
|
||||
// TODO Auto-generated method stub
|
||||
return userMapper.selectUserList(userSearchVO);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.mca.cmmn.mapper.UserCertificationMapper">
|
||||
|
||||
<insert id="insertCertificationNum" parameterType="userCertificationVO">
|
||||
insert into user_certification values(
|
||||
#{userid}, #{certification_num}, #{expiration_date}, 'ready'
|
||||
)ON DUPLICATE KEY UPDATE
|
||||
certification_num = #{certification_num},
|
||||
expiration_date = #{expiration_date},
|
||||
status = 'ready';
|
||||
</insert>
|
||||
<select id="selectCertificationInfo" parameterType="userCertificationVO" resultType="userCertificationVO">
|
||||
select *
|
||||
from user_certification
|
||||
where userid = #{userid}
|
||||
</select>
|
||||
<update id="updateCertificationNumStatus" parameterType="userCertificationVO">
|
||||
update user_certification
|
||||
set status = #{status}
|
||||
where userid = #{userid}
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
@ -146,10 +146,13 @@
|
|||
</select>
|
||||
|
||||
<select id="findPwd" resultType="userVO">
|
||||
select * from t_user where id=#{id} and name=#{name} and phonenum=#{phonenum}
|
||||
select userid, email, name
|
||||
from t_user
|
||||
where userid=#{userid}
|
||||
and email=#{email}
|
||||
</select>
|
||||
|
||||
<update id="updatePwd">
|
||||
<update id="updatePwd" parameterType="userVO">
|
||||
update t_user set password=#{password} where userid=#{userid}
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
@ -8,6 +8,7 @@
|
|||
<typeAlias alias="baseSearchVO" type="com.mca.cmmn.vo.BaseSearchVO" />
|
||||
<typeAlias alias="layersVO" type="com.mca.cmmn.vo.LayersVO" />
|
||||
<typeAlias alias="logVO" type="com.mca.cmmn.vo.LogVO" />
|
||||
<typeAlias alias="userCertificationVO" type="com.mca.cmmn.vo.UserCertificationVO" />
|
||||
<typeAlias alias="areaCodeVO" type="com.mca.cmmn.vo.AreaCodeVO" />
|
||||
|
||||
<typeAlias alias="useRequestVO" type="com.mca.map.vo.UseRequestVO"/>
|
||||
|
|
|
|||
|
|
@ -3,38 +3,3 @@
|
|||
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
|
||||
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui" %>
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
|
||||
<div class="loginWrap">
|
||||
<div class="loginBox">
|
||||
<form method="POST">
|
||||
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
|
||||
<input type=hidden name=login_error value="${login_error}"/>
|
||||
<p class="login_title text-white">모바일센터 관리시스템</p>
|
||||
<p class="login_text">
|
||||
<label>이름<input type="text" class="form-control" name="username" id="username" value="" placeholder="이름"/></label>
|
||||
</p>
|
||||
<p class="login_text">
|
||||
<label>email<input type="tel" class="form-control" name="phonenum" id="phonenum" value="" placeholder="연락처"/></label>
|
||||
</p>
|
||||
|
||||
<div>
|
||||
<input class="btn" type="submit" value="check">
|
||||
</div>
|
||||
<%-- 이름번호 일치x --%>
|
||||
<c:if test="${check == 1}">
|
||||
<script>
|
||||
opener.document._findForm.name.value = "";
|
||||
opener.document._findForm.phonenum.value = "";
|
||||
</script>
|
||||
</c:if>
|
||||
<label>일치하는 정보가 없습니다.</label>
|
||||
<c:if test="${check == 0}">
|
||||
<label>찾으시는 아이디는 ${userid}입니다</label>
|
||||
</c:if>
|
||||
<input class="btn" type="submit"><a href="../login.jsp">로그인</a>
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -3,64 +3,191 @@
|
|||
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
|
||||
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui" %>
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
|
||||
<div class="loginBox">
|
||||
<form method="POST" name="findForm">
|
||||
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
|
||||
<input type=hidden name=login_error value="${login_error}"/>
|
||||
<p class="login_title text-white">모바일센터 관리시스템</p>
|
||||
<p class="login_text">
|
||||
<label>아이디<input type="text" class="form-control" name="userid" id="userid" value="" placeholder="아이디"/></label>
|
||||
</p>
|
||||
|
||||
<p class="login_text">
|
||||
<label>이름<input type="text" class="form-control" name="username" id="username" value="" placeholder="이름"/></label>
|
||||
</p>
|
||||
<p class="login_text">
|
||||
<label>email<input type="tel" class="form-control" name="phonenum" id="phonenum" value="" placeholder="연락처"/></label>
|
||||
</p>
|
||||
|
||||
<div>
|
||||
<input class="btn" type="submit" value="check">
|
||||
</div>
|
||||
<%-- 이름번호 일치x --%>
|
||||
<c:if test="${check == 1}">
|
||||
<script>
|
||||
opener.document._findForm.id.value = "";
|
||||
opener.document._findForm.name.value = "";
|
||||
opener.document._findForm.phonenum.value = "";
|
||||
</script>
|
||||
<label>일치하는 정보가 없습니다.</label>
|
||||
</c:if>
|
||||
|
||||
<c:if test="${check == 0}">
|
||||
<div>
|
||||
<label>비밀번호를 변경해주세요</label>
|
||||
</div>
|
||||
<p class="login_text">
|
||||
<label>비밀번호<input type="password" class="form-control" name="password" id="password" value="" placeholder="비밀번호"/></label>
|
||||
</p>
|
||||
<p class="login_text">
|
||||
<label>비밀번호확인<input type="password" class="form-control" name="passwordCheck" id="passwordCheck" value="" placeholder="비밀번호 확인"/></label>
|
||||
</p>
|
||||
</c:if>
|
||||
|
||||
<input class="btn" type="submit" value="update Pwd" onclick="updatePwd()">
|
||||
<script type="text/javascript">
|
||||
$(document).on('click', '#sendEmail', function (){
|
||||
sendEmail();
|
||||
})
|
||||
$(document).on('click', '#certifyNumCheck', function (){
|
||||
certifyNumCheck();
|
||||
})
|
||||
$(document).on('click', '#passwordUpdate', function (){
|
||||
passwordUpdate();
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
function updatePwd(){
|
||||
if(password == "" || password == undefined || password == null){
|
||||
alert("비밀번호를 입력해주세요")
|
||||
} else if(passwordCheck == "" || passwordCheck == undefined || passwordCheck == null){
|
||||
alert("비밀번호 확인을 입력해주세요")
|
||||
|
||||
} else {
|
||||
document.findform.action = "updatepwd";
|
||||
document.findform.submit();
|
||||
function sendEmail(){
|
||||
if(inputCheck()){
|
||||
$.ajax({
|
||||
url: "/sendEmail",
|
||||
type: "GET",
|
||||
data: {
|
||||
userid: $("#userid").val(),
|
||||
email: $("#email").val()
|
||||
},
|
||||
success: function (result) {
|
||||
sendEmailAfter(result)
|
||||
},
|
||||
error: function (request, status, error) {
|
||||
alert("인증번호 전송에 실패하였습니다.\n 관리자에게 문의해주세요.");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
function inputCheck(){
|
||||
if(!$("#userid").val()){
|
||||
alert("아이디를 입력해주세요.")
|
||||
return false;
|
||||
}
|
||||
if(!$("#email").val()){
|
||||
alert("이메일을 입력해주세요.")
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function sendEmailAfter(result){
|
||||
switch (result) {
|
||||
case "userNull":
|
||||
alert("입력된 계정 정보가 없습니다.")
|
||||
break;
|
||||
case "mailError":
|
||||
alert("인증번호 전송에 실패하였습니다.\n 관리자에게 문의해주세요.");
|
||||
break;
|
||||
case "mailSend":
|
||||
alert("인증번호 전송에 성공하였습니다.\n 인증번호를 확인해주세요.")
|
||||
$("#step1").hide();
|
||||
$("#step2").show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function certifyNumCheck(){
|
||||
$.ajax({
|
||||
url: "/certifyNumCheck",
|
||||
type: "GET",
|
||||
data: {
|
||||
userid: $("#userid").val(),
|
||||
certification_num: $("#certification_num").val()
|
||||
},
|
||||
success: function (result) {
|
||||
certifyNumCheckAfter(result);
|
||||
},
|
||||
error: function (request, status, error) {
|
||||
alert("에러가 발생하였습니다. 관리자에게 문의해주세요.");
|
||||
}
|
||||
});
|
||||
}
|
||||
function certifyNumCheckAfter(result){
|
||||
switch (result){
|
||||
case "InfoNull":
|
||||
alert("인증번호 발급 정보가 없습니다.");
|
||||
break;
|
||||
case "numberNotMatch":
|
||||
alert("저장된 인증번호와 같지 않습니다.");
|
||||
break;
|
||||
case "expirationTimeAfter":
|
||||
alert("인증번호 유효시간이 만료되었습니다.");
|
||||
break;
|
||||
case "OK":
|
||||
alert("인증되었습니다.");
|
||||
$("#step2").hide();
|
||||
$("#step3").show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
function passwordUpdate(){
|
||||
if(passwordCheck()){
|
||||
$.ajax({
|
||||
url: "/passwordUpdate",
|
||||
type: "POST",
|
||||
data: {
|
||||
userid: $("#userid").val(),
|
||||
password: $("#password").val()
|
||||
},
|
||||
beforeSend: function (xhr){
|
||||
xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val());
|
||||
},
|
||||
success: function (result) {
|
||||
passwordUpdateAfter(result);
|
||||
},
|
||||
error: function (request, status, error) {
|
||||
alert("에러가 발생하였습니다. 관리자에게 문의해주세요.");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function passwordCheck(){
|
||||
const password = $("#password").val()
|
||||
const passwordConfirm = $("#passwordConfirm").val()
|
||||
if(!password){
|
||||
alert("새 비밀번호를 입력해주세요.")
|
||||
return false;
|
||||
}
|
||||
if(!passwordConfirm){
|
||||
alert("재입력을 입력해주세요.")
|
||||
return false;
|
||||
}
|
||||
if(password !== passwordConfirm){
|
||||
alert("비밀번호가 같지 않습니다.")
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function passwordUpdateAfter(result){
|
||||
debugger
|
||||
if (result==="OK"){
|
||||
alert("변경되었습니다.");
|
||||
multiModal.close();
|
||||
}else{
|
||||
alert("변경에 실패하였습니다.")
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="row justify-content-end" id="step1">
|
||||
<div class="col-12 row m-1">
|
||||
<label for="userid" class="col-4 text-end">아이디</label>
|
||||
<div class="col-8">
|
||||
<input type="text" class="form-control" id="userid">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 row m-1">
|
||||
<label for="email" class="col-4 text-end">이메일</label>
|
||||
<div class="col-8">
|
||||
<input type="email" class="form-control" id="email">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-8">
|
||||
<button type="button" id="sendEmail" class="btn btn-primary m-3">인증번호 발송</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row justify-content-end" id="step2" style="display: none">
|
||||
<div class="col-12 row m-1">
|
||||
<label for="certification_num" class="col-4 text-end">인증번호</label>
|
||||
<div class="col-8">
|
||||
<input type="email" class="form-control" id="certification_num">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-8">
|
||||
<button type="button" id="certifyNumCheck" class="btn btn-primary m-3">인증번호 확인</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row justify-content-end" id="step3" style="display: none">
|
||||
<div class="col-12 row m-1">
|
||||
<label for="password" class="col-4 text-end">새 비밀번호</label>
|
||||
<div class="col-8">
|
||||
<input type="password" class="form-control" id="password">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 row m-1">
|
||||
<label for="passwordConfirm" class="col-4 text-end">재입력</label>
|
||||
<div class="col-8">
|
||||
<input type="password" class="form-control" id="passwordConfirm">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-8">
|
||||
<button type="button" id="passwordUpdate" class="btn btn-primary m-3">비밀번호 변경</button>
|
||||
<input type="hidden" name="_csrf_header" value="${_csrf.headerName}"/>
|
||||
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -9,9 +9,15 @@
|
|||
multiModal = new bootstrap.Modal(document.getElementById('multiModal'));
|
||||
// multiModal = document.getElementById('multiModal');
|
||||
})
|
||||
$(document).on('click', '.joinLink', function (){
|
||||
$(document).on('click', '.joinBtn', function (){
|
||||
getModalBody("/join", "회원가입");
|
||||
})
|
||||
$(document).on('click', '.findIdBtn', function (){
|
||||
getModalBody("/findId", "아이디 찾기");
|
||||
})
|
||||
$(document).on('click', '.findPasswordBtn', function (){
|
||||
getModalBody("/findPwd", "비밀번호 찾기");
|
||||
})
|
||||
|
||||
function getModalBody(url, labelText){
|
||||
$("#multiModalLabel").text(labelText);
|
||||
|
|
@ -45,13 +51,12 @@
|
|||
</p>
|
||||
<div class="row justify-content-between mx-3">
|
||||
<div class="col-auto">
|
||||
<a class="text-white" href="<c:url value="/findId" />">아이디 찾기</a>
|
||||
<a class="text-white findIdBtn" href="#">아이디 찾기</a>
|
||||
<br>
|
||||
<a class="text-white" href="<c:url value="/findPwd" />">비밀번호 찾기</a>
|
||||
<a class="text-white findPasswordBtn" href="#">비밀번호 찾기</a>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<%--<c:url value=" /join" />--%>
|
||||
<a class="text-white joinLink" href="#">회원가입</a>
|
||||
<a class="text-white joinBtn" href="#">회원가입</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
|||
Loading…
Reference in New Issue