id/pwd 작업중

master
Hyung Geun 2022-03-10 11:02:40 +09:00
parent 958b407558
commit cc5bd96957
8 changed files with 347 additions and 8 deletions

View File

@ -7,10 +7,7 @@ import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.mca.cmmn.service.AreaCodeService; import com.mca.cmmn.service.AreaCodeService;
import com.mca.user.service.UserService; import com.mca.user.service.UserService;
@ -172,4 +169,66 @@ public class CommonController {
public String accessDenied() throws Exception { public String accessDenied() throws Exception {
return "error/EgovAccessDenied"; return "error/EgovAccessDenied";
} }
} // 아이디 찾기 페이지 이동
@RequestMapping(value = "findId")
public String findIdView(){
return "findId";
}
// 아이디 찾기 실행
@RequestMapping(value = "findId", method = RequestMethod.POST)
public String findIdAction(UserVO userVO, Model model) {
UserVO user = userService.findId(userVO);
if (user == null) {
model.addAttribute("check", 1);
} else {
model.addAttribute("check", 2);
model.addAttribute("id", user.getUserid());
}
return "findId";
}
//pw찾기 페이지 이동
@RequestMapping(value = "findPwd")
public String findPwdView(){
return "findPwd";
}
//pw찾기 실행
@RequestMapping(value = "findPwd", method = RequestMethod.POST)
public String findPwdAction(UserVO userVO, Model model){
UserVO user = userService.findPwd(userVO);
if (user == null) {
model.addAttribute("check", 1);
} else {
model.addAttribute("check", 0);
model.addAttribute("updateid", user.getUserid());
}
return "findPwd";
}
//pw 바꾸기 실행
@RequestMapping(value = "updatepwd", method = RequestMethod.POST)
public String updatePwdAction(@RequestParam(value = "updateid", defaultValue = "", required = false) String id, UserVO userVO) {
userVO.setUserid(id);
System.out.println(userVO);
userService.updatePwd(userVO);
return "findPwdConfirm";
}
// 비밀번호 변경 성공페이지 이동
public String CheckPwd(HttpSession session, Model model){
UserVO loginUser = (UserVO) session.getAttribute("loginUser");
if (loginUser == null) {
return "login";
} else {
return "checkform";
}
}
}

View File

@ -27,4 +27,8 @@ public interface UserMapper {
public void updateUserDelete(String userid); public void updateUserDelete(String userid);
public void updateUser(UserVO userVO); public void updateUser(UserVO userVO);
public UserVO findId(UserVO userVO);
public UserVO findPwd(UserVO userVO);
public void updatePwd(UserVO userVO);
} }

View File

@ -78,4 +78,19 @@ public class UserService {
userMapper.updateUser(userVO); userMapper.updateUser(userVO);
} }
//아이디 비밀번호 찾기
public UserVO findId(UserVO userVO) {
// TODO Auto-generated method stub
return userMapper.findId(userVO);
}
public UserVO findPwd(UserVO userVO) {
// TODO Auto-generated method stub
return userMapper.findPwd(userVO);
}
public void updatePwd(UserVO userVO) {
// TODO Auto-generated method stub
userMapper.updatePwd(userVO);
}
} }

View File

@ -139,5 +139,17 @@
phonenum = #{phonenum} phonenum = #{phonenum}
WHERE userid = #{userid} WHERE userid = #{userid}
</update> </update>
<!--아이디 비밀번호찾기-->
<select id="findId" resultType="userVO">
select * from t_user where name=#{name} and phonenum=#{phonenum}
</select>
<select id="findPwd" resultType="userVO">
select * from t_user where id=#{id} and name=#{name} and phonenum=#{phonenum}
</select>
<update id="updatePwd">
update t_user set password=#{password} where userid=#{userid}
</update>
</mapper> </mapper>

View File

@ -0,0 +1,62 @@
<%@ 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="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" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>모바일센터 관리시스템</title>
<script src="<c:out value="/js/jquery-3.5.1.min.js" />"></script>
<script src="<c:out value="/js/bootstrap-3.3.2.min.js" />"></script>
<link href="<c:out value="/css/normalize.css" />" rel="stylesheet">
<link href="<c:out value="/css/bootstrap.min.css" />" rel="stylesheet">
<link href="<c:out value="/css/style.css" />" rel="stylesheet">
</head>
<body>
<header class="header">
<div class="header_title"><a href="/">모바일센터 관리시스템</a></div>
<div class="header_menu"></div>
</header>
<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>
</body>
</html>

View File

@ -0,0 +1,91 @@
<%@ 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="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" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>모바일센터 관리시스템</title>
<script src="<c:out value="/js/jquery-3.5.1.min.js" />"></script>
<script src="<c:out value="/js/bootstrap-3.3.2.min.js" />"></script>
<link href="<c:out value="/css/normalize.css" />" rel="stylesheet">
<link href="<c:out value="/css/bootstrap.min.css" />" rel="stylesheet">
<link href="<c:out value="/css/style.css" />" rel="stylesheet">
</head>
<body>
<header class="header">
<div class="header_title"><a href="/">모바일센터 관리시스템</a></div>
<div class="header_menu"></div>
</header>
<div class="loginWrap">
<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()">
</form>
</div>
</div>
</body>
<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();
}
}
</script>
</html>

View File

@ -0,0 +1,90 @@
<%@ 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="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" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>모바일센터 관리시스템</title>
<script src="<c:out value="/js/jquery-3.5.1.min.js" />"></script>
<script src="<c:out value="/js/bootstrap-3.3.2.min.js" />"></script>
<link href="<c:out value="/css/normalize.css" />" rel="stylesheet">
<link href="<c:out value="/css/bootstrap.min.css" />" rel="stylesheet">
<link href="<c:out value="/css/style.css" />" rel="stylesheet">
</head>
<body>
<header class="header">
<div class="header_title"><a href="/">모바일센터 관리시스템</a></div>
<div class="header_menu"></div>
</header>
<div class="loginWrap">
<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()">
</form>
</div>
</div>
</body>
<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();
}
}
</script>
</html>

View File

@ -21,10 +21,16 @@
</p> </p>
<div class="parent"> <div class="parent">
<div class="find"> <div class="find_id">
<span class="glyphicon glyphicon-info-sign"></span> <span class="glyphicon glyphicon-info-sign"></span>
<a class="text-white" href="#">아이디/비밀번호 찾기</a> <a class="text-white" href="<c:url value="/findId" />">아이디 찾기</a>
</div> </div>
<div class="find_pw">
<span class="glyphicon glyphicon-info-sign"></span>
<a class="text-white" href="<c:url value="/findPwd" />">비밀번호 찾기</a>
</div>
<div class="join"> <div class="join">
<span class="glyphicon glyphicon-user"></span> <span class="glyphicon glyphicon-user"></span>
<a class="text-white" href="<c:url value=" /join" />">회원가입</a> <a class="text-white" href="<c:url value=" /join" />">회원가입</a>