no message

main
이범준 1 year ago
parent 9041402908
commit 02d034795c

@ -49,23 +49,19 @@ public class XitLoginController extends AbstractController {
private XitFrameCrudService xitFrameCrudService;
private String LOGIN_PAGE ="framework/biz/login/XitLoginUsr";
private String LOGIN_PAGE = "fimslogin";
private String ACCESS_DENIED_PAGE = "login/XitAccessDenied";
private String MAIN_PAGE = "/framework/biz/cmm/mainPage.do";
private String MAIN_PAGE_USR ="";
/**
*
*
* @param
* @return
* @exception Exception
* @throws Exception
*/
@RequestMapping(name = "", value = "/actionMain")
public String actionMain()
@ -78,8 +74,7 @@ public class XitLoginController extends AbstractController {
return LOGIN_PAGE;
}
String url = this.getMainPageUrlByUserSe();
return "forward:"+url;
return "forward:" + "/framework/biz/cmm/mainPage.do";
}
/**
@ -109,7 +104,7 @@ public class XitLoginController extends AbstractController {
* :
*/
//비인증 상태에서 인가되지 않은 URL 호출에 대한 처리
if(XitCmmnUtil.isEmpty(paraMap)) {
if (XitCmmnUtil.isEmpty(paraMap)) {
return "forward:/login/accessDenied.do";
}
@ -155,22 +150,18 @@ public class XitLoginController extends AbstractController {
throw new IllegalStateException("No AuthenticationProcessingFilter");
}
springSecurity.doFilter(new RequestWrapperForSecurity(request,
xitLoginVO.getUniqId(),
xitLoginVO.getPasswd()),
response, null);
xitLoginService.actionLoginSuccess();//로그인 Log 생성
// 2. 메인 페이지 이동
String url = this.getMainPageUrlByUserSe();
return "forward:"+url; // 성공 시 페이지.. (redirect 불가)
return "forward:" + "/framework/biz/cmm/mainPage.do";
} else {
model.addAttribute("message", message==null?"로그인정보가 올바르지 않습니다.":message);
model.addAttribute("message", message == null ? "로그인정보가 올바르지 않습니다." : message);
return LOGIN_PAGE;
}
@ -180,14 +171,14 @@ public class XitLoginController extends AbstractController {
* .
*
* @return String
* @exception Exception
* @throws Exception
*/
@RequestMapping(name = "", value = "/actionLogout")
public String actionLogout(HttpServletRequest request) {
request.getSession().setAttribute("XitLoginSession", null);
ApplicationContext act = WebApplicationContextUtils.getRequiredWebApplicationContext(request.getSession().getServletContext());
SecurityConfig config = (SecurityConfig)act.getBean(SecurityConfig.class);
SecurityConfig config = (SecurityConfig) act.getBean(SecurityConfig.class);
String logoutSuccessUrl = config.getLogoutSuccessUrl();
SecurityContext context = SecurityContextHolder.getContext();
@ -199,48 +190,49 @@ public class XitLoginController extends AbstractController {
/**
*
*
* @return String
* @exception Exception
* @throws Exception
*/
@RequestMapping(name = "", value="accessDenied")
@RequestMapping(name = "", value = "accessDenied")
public void accessDenied(HttpServletRequest request, HttpServletResponse response) throws Exception {
/**
*
*/
if(AjaxUtils.isAjaxRequest(request)){ //ajax
if (AjaxUtils.isAjaxRequest(request)) { //ajax
//Response & Message Set
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=UTF-8");
PrintWriter writer=response.getWriter();
PrintWriter writer = response.getWriter();
String msg = "요청에 대한 권한이 없습니다.";
//응답
writer.println(msg);
}else { //submit
} else { //submit
Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
//인증사용자
if(isAuthenticated) {
if (isAuthenticated) {
//응답
response.sendRedirect(FrameworkConstants.FRAMEWORK_JSP_BASE_PATH +ACCESS_DENIED_PAGE);
response.sendRedirect(FrameworkConstants.FRAMEWORK_JSP_BASE_PATH + ACCESS_DENIED_PAGE);
//미인증사용자
}else {
} else {
//Response & Message Set
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html; charset=UTF-8");
PrintWriter writer=response.getWriter();
PrintWriter writer = response.getWriter();
String msg = "요청에 대한 권한이 없습니다.";
//응답
String contextPath = request.getContextPath();
boolean isExistsContextPath = "/".equals(contextPath)?false:true;
if(isExistsContextPath)
writer.println("<script type='text/javascript'>alert(\""+msg+"\"); location.href='"+contextPath+"/login/actionMain.do';</script>");
boolean isExistsContextPath = "/".equals(contextPath) ? false : true;
if (isExistsContextPath)
writer.println("<script type='text/javascript'>alert(\"" + msg + "\"); location.href='" + contextPath + "/login/actionMain.do';</script>");
else
writer.println("<script type='text/javascript'>alert(\""+msg+"\"); location.href='/login/actionMain.do';</script>");
writer.println("<script type='text/javascript'>alert(\"" + msg + "\"); location.href='/login/actionMain.do';</script>");
}
}
@ -248,33 +240,34 @@ public class XitLoginController extends AbstractController {
/**
* <pre> : </pre>
*
* @param page
* @param vo
* @return
* @author:
* @throws Exception
* @author:
* @date: 2020. 10. 21.
*/
@RequestMapping(name = "", value = "/findIdPopup/{page}")
public ModelAndView findIdPopup(@PathVariable String page, @ModelAttribute("xitLoginVO") XitLoginVO vo) throws Exception{
public ModelAndView findIdPopup(@PathVariable String page, @ModelAttribute("xitLoginVO") XitLoginVO vo) throws Exception {
ModelAndView mav = new ModelAndView();
if(page.endsWith(".do") || page.endsWith(".ajax")){
page = page.substring(0,page.lastIndexOf("."));
if (page.endsWith(".do") || page.endsWith(".ajax")) {
page = page.substring(0, page.lastIndexOf("."));
}
switch (page) {
case "input": //아이디 찾기 -정보입력 페이지
mav.setViewName(FrameworkConstants.FRAMEWORK_JSP_BASE_PATH +"login/findIdFormPopup.popup");
mav.setViewName(FrameworkConstants.FRAMEWORK_JSP_BASE_PATH + "login/findIdFormPopup.popup");
break;
case "inputEvr": //(모든사용자)아이디 찾기 -정보입력 페이지
mav.setViewName(FrameworkConstants.FRAMEWORK_JSP_BASE_PATH +"login/findIdEvrFormPopup.popup");
mav.setViewName(FrameworkConstants.FRAMEWORK_JSP_BASE_PATH + "login/findIdEvrFormPopup.popup");
break;
case "result": //아이디 찾기 -결과
XitLoginVO loginVO = xitLoginService.findId(vo);
mav.addObject("userAcnt",loginVO.getId());
mav.setViewName(FrameworkConstants.FRAMEWORK_JSP_BASE_PATH +"login/findIdResultFormPopup.popup");
mav.addObject("userAcnt", loginVO.getId());
mav.setViewName(FrameworkConstants.FRAMEWORK_JSP_BASE_PATH + "login/findIdResultFormPopup.popup");
break;
default:
@ -286,6 +279,7 @@ public class XitLoginController extends AbstractController {
/**
* <pre> : </pre>
*
* @param xitUserInfoVO
* @param page
* @throws IOException
@ -298,20 +292,20 @@ public class XitLoginController extends AbstractController {
public ModelAndView findPwdPopup(@ModelAttribute("xitUserInfoVO") XitUserInfoVO xitUserInfoVO, @PathVariable String page) throws RuntimeException {
ModelAndView mav = new ModelAndView();
if(page.endsWith(".do") || page.endsWith(".ajax")){
page = page.substring(0,page.lastIndexOf("."));
if (page.endsWith(".do") || page.endsWith(".ajax")) {
page = page.substring(0, page.lastIndexOf("."));
}
switch (page) {
case "input": //비밀번호 찾기 -정보입력 페이지
mav.setViewName(FrameworkConstants.FRAMEWORK_JSP_BASE_PATH +"login/findPwdFormPopup.popup");
mav.setViewName(FrameworkConstants.FRAMEWORK_JSP_BASE_PATH + "login/findPwdFormPopup.popup");
break;
case "inputEvr": //(모든사용자)비밀번호 찾기 -정보입력 페이지
mav.setViewName(FrameworkConstants.FRAMEWORK_JSP_BASE_PATH +"login/findPwdEvrFormPopup.popup");
mav.setViewName(FrameworkConstants.FRAMEWORK_JSP_BASE_PATH + "login/findPwdEvrFormPopup.popup");
break;
case "result": //비밀번호 찾기 -결과
mav.setViewName(FrameworkConstants.FRAMEWORK_JSP_BASE_PATH +"login/findPwdResultFormPopup.popup");
mav.setViewName(FrameworkConstants.FRAMEWORK_JSP_BASE_PATH + "login/findPwdResultFormPopup.popup");
break;
default:
@ -322,16 +316,17 @@ public class XitLoginController extends AbstractController {
/**
* <pre> : CRUD </pre>
*
* @param res
* @param model
* @param session
* @param vo xitUserInfoVO
* @return
* @author:
* @throws Exception
* @author:
* @date: 2020. 10. 21.
*/
@RequestMapping(name = "", value = "FindPwd_{cmd}_proc", method=RequestMethod.POST)
@RequestMapping(name = "", value = "FindPwd_{cmd}_proc", method = RequestMethod.POST)
public void FindPwd_cmd_proc(HttpServletResponse res, Model model
, HttpSession session
, @ModelAttribute("xitLoginVO") XitLoginVO vo
@ -347,7 +342,7 @@ public class XitLoginController extends AbstractController {
case "select": //조회
XitLoginVO loginVO = xitLoginService.findPassword(vo);
resultMap.put("result", XitCmmnUtil.isEmpty(loginVO.getId())?"N":"Y");
resultMap.put("result", XitCmmnUtil.isEmpty(loginVO.getId()) ? "N" : "Y");
break;
// case "insert": //등록
@ -370,7 +365,7 @@ public class XitLoginController extends AbstractController {
message = "변경에 실패하였습니다.";
failDetail = e.getMessage();
}
model.addAttribute("result", result?"Y":"N");
model.addAttribute("result", result ? "Y" : "N");
model.addAttribute("message", message);
model.addAttribute("failDetail", failDetail);
model.addAttribute("tempPwd", vo.getPasswd());
@ -392,20 +387,21 @@ public class XitLoginController extends AbstractController {
/**
*
*/
if(AjaxUtils.isAjaxRequest(request)){ //ajax 요청시
if (AjaxUtils.isAjaxRequest(request)) { //ajax 요청시
//반환 데이터 설정
Iterator<String> keys = resultMap.keySet().iterator();
while(keys.hasNext()) {
while (keys.hasNext()) {
String key = keys.next();
Object value = resultMap.get(key);
request.setAttribute(key, value);
}
request.getRequestDispatcher("/login/responseJson").forward(request, response);
}else { //submit 요청 시
} else { //submit 요청 시
XitCmmnUtil.forwardForSubmitRequest(request, response, sLocationUrl, model.asMap());
}
}
@RequestMapping(name = "", value="responseJson", method={RequestMethod.GET, RequestMethod.POST})
@RequestMapping(name = "", value = "responseJson", method = {RequestMethod.GET, RequestMethod.POST})
@ResponseBody
public Map<String, Object> responseJson(HttpServletRequest request
) {
@ -414,78 +410,11 @@ public class XitLoginController extends AbstractController {
*/
Map<String, Object> resultMap = new HashMap<String, Object>();
Object respData = request.getAttribute("result");
if(XitCmmnUtil.notEmpty(respData))
if (XitCmmnUtil.notEmpty(respData))
resultMap.put("result", respData);
return resultMap;
}
/**
* <pre> : (//) .
* - default(Globals.Xit.MainPage) .
* [ ]
* Globals.Xit.MainPage.Gnr //일반회원
* Globals.Xit.MainPage.Ent //기업회원
* Globals.Xit.MainPage.Usr //업무사용자
* </pre>
* @return String
* @author:
* @date: 2020. 11. 20.
*/
private String getMainPageUrlByUserSe() {
String url = MAIN_PAGE;
XitLoginVO loginVO = XitCmmnUtil.getUserInfo();
USER_SE userSe = USER_SE.valueOf(loginVO.getUserSe());
if(!XitCmmnUtil.isEmpty(userSe)) {
switch (userSe) {
case USR: //업무사용자
if(XitCmmnUtil.notEmpty(MAIN_PAGE_USR))
url = MAIN_PAGE_USR;
break;
default:
break;
}
}
return url;
}
}
class RequestWrapperForSecurity extends HttpServletRequestWrapper {
private String username = null;
private String password = null;
public RequestWrapperForSecurity(HttpServletRequest request, String id, String passwd) {
super(request);
this.username = id;
this.password = passwd;
}
@Override
public String getServletPath() {
return ((HttpServletRequest) super.getRequest()).getContextPath() + "/xit_security_login";
}
@Override
public String getRequestURI() {
return ((HttpServletRequest) super.getRequest()).getContextPath() + "/xit_security_login";
}
@Override
public String getParameter(String name) {
if (name.equals("xit_security_username")) {
return username;
}
if (name.equals("xit_security_password")) {
return password;
}
return super.getParameter(name);
}
}

@ -1,322 +0,0 @@
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp" %>
<%@ include file="/WEB-INF/jsp/include/fims/taglib.jsp" %>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="ko">
<head>
<meta http-equiv="Content-Language" content="ko" >
<title>로그인</title>
<link href="<c:url value='/'/>resources/css/fims/framework/oldcommon.css" rel="stylesheet" type="text/css" >
<link href="<c:url value='/'/>resources/css/fims/framework/login.css" rel="stylesheet" type="text/css" >
<link rel="stylesheet" type="text/css" href="<c:url value='/'/>/resources/3rd-party/jquery-ui/1.13.2/themes/redmond/jquery-ui.css" />
<script type="text/javascript" src="<c:url value='/'/>/resources/3rd-party/jquery-ui/1.13.2/jquery-ui.js" ></script>
<script type="text/javascript">
/**
* 로그인
*/
function actionLogin() {
if (document.loginForm.id.value =="") {
alert("아이디를 입력하세요");
return false;
} else if (document.loginForm.passwd.value =="") {
alert("비밀번호를 입력하세요");
return false;
} else {
TabsUtil.setUseSe();
document.loginForm.action="<c:url value='/login/actionSecurityLogin.do'/>";
//document.loginForm.j_username.value = document.loginForm.userSe.value + document.loginForm.username.value;
//document.loginForm.action="<c:url value='/j_spring_security_check'/>";
document.loginForm.submit();
}
}
/**
* 쿠키 설정
*/
function setCookie (name, value, expires) {
document.cookie = name + "=" + escape (value) + "; path=/; expires=" + expires.toGMTString();
}
/**
* 쿠키 조회
* -쿠키에 저장된 목록을 조회 한다.
*/
function getCookie(Name) {
var search = Name + "="
if (document.cookie.length > 0) { // 쿠키가 설정되어 있다면
offset = document.cookie.indexOf(search)
if (offset != -1) { // 쿠키가 존재하면
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset)
// 쿠키 값의 마지막 위치 인덱스 번호 설정
if (end == -1)
end = document.cookie.length
return unescape(document.cookie.substring(offset, end))
}
}
return "";
}
/**
* 쿠키에 ID 저장or제거
* -"로그인ID 저장여부"를 check 시 일정기간동안 쿠키에 ID를 저장 한다.
* -"로그인ID 저장여부"를 uncheck 시 쿠키에 저장된 ID를 삭제 한다.
*/
function saveid(form) {
var expdate = new Date();
// 기본적으로 30일동안 기억하게 함. 일수를 조절하려면 * 30에서 숫자를 조절하면 됨
if (form.checkId.checked)
expdate.setTime(expdate.getTime() + 1000 * 3600 * 24 * 30); // 30일
else
expdate.setTime(expdate.getTime() - 1); // 쿠키 삭제조건
setCookie("saveid", form.id.value, expdate);
}
/**
* 쿠키에 저장된 ID 취득
* -저장된 ID가 존재할 경우 "로그인ID 저장여부"항목을 check 설정 한다.
*/
function getid(form) {
form.checkId.checked = ((form.id.value = getCookie("saveid")) != "");
}
function fnInit() {
var message = document.loginForm.message.value;
if (message != "") {
alert(message);
}
// getid(document.loginForm);
$('#id').focus();
CaptchaUtil.init();
TabsUtil.init();
}
/**
* 회원가입 팝업
*/
function fnReg(){
var popUrl ="${ctx}/_anonymous_/login/UserReg_inputEvr.do";
var popOption = "width=620px, height=240px, resizable=no, scrollbars=yes, location=no, top=100px, left=100px";
var target = '사용자등록';
window.open(popUrl,target,popOption);
}
/**
* 아이디 찾기 팝업
*/
function fn_FindId(){
var popUrl = "${ctx}/login/findIdPopup/inputEvr.do";
var popOption = "width=530px, height=365x, resizable=no, location=no, top=100px, left100px";
var target = '아이디 찾기';
window.open(popUrl,target,popOption);
}
/**
* 비밀번호 찾기 팝업
*/
function fn_FindPw(){
var popUrl = "${ctx}/login/findPwdPopup/inputEvr.do";
var popOption = "width=530px, height=380px, resizable=no, location=no, top=100px, left100px";
var target = '비밀번호 찾기';
window.open(popUrl,target,popOption);
}
/**
* 캡차 인증 도구
* @date 2020.09.22.
* @author 박민규
*/
var CaptchaUtil = {
init: function(){
//캡차인증 이미지 출력
CaptchaUtil.refresh();
//새로고침 버튼 EventListener 설정
$('#btn_captchaRefresh').on({
click: function(){
CaptchaUtil.refresh();
return false;
}
});
//자동로그인방지문자 입력란 EventListener 설정
$('#captcha').on({
keypress: function(){
if(event.keyCode==13){
actionLogin();
return false;
}
},
keyup: function(){
this.value = this.value.toLowerCase();
}
});
},
refresh: function(){
/* ==============================
* 2020.09.22 박민규
* IE 동작이슈 처리
* -사유: 크롬에서 정상동작 하나 IE에서 img 태그에 이미지가 출력된 상태에서
* document.querySelector('#captchaImg').setAttribute('src', url)를 호출해도 이벤트가 발생하지 않음.
* -해결: 이미지 태그의 src(이미지 경로)를 제거 후 timeout을 이용하여 일정시간 후 document.querySelector('#captchaImg').setAttribute('src', url) 호출
============================== */
//2020.09.22 주석처리
// var url = '<c:url value="/_anonymous_/captcha.do"/>';
// document.querySelector('#captchaImg').setAttribute('src', url);
var url = '<c:url value="/_anonymous_/captcha.do"/>';
// IE old version ( IE 10 or Lower )
if ( navigator.appName == "Microsoft Internet Explorer" ){
document.querySelector('#captchaImg').removeAttribute('src');
setTimeout(function(){
document.querySelector('#captchaImg').setAttribute('src', url);
}, 20);
}
// 그 외 브라우저
else{
document.querySelector('#captchaImg').setAttribute('src', url);
}
}
}
/**
* 탭 도구
* @date 2020.11.18.
* @author 박민규
*/
var TabsUtil = {
init: function(){
$("#userSeTabs").tabs();
$("#userSeTabs ul").show();
},
activeTab: function(){
var selectedTab = $("#userSeTabs").tabs('option', 'active');
return selectedTab;
},
activeForm: function(){
var selectedTab = TabsUtil.activeTab();
var form = $('#tabs-'+selectedTab+' form')[0];
return form;
},
setUseSe: function(){
var selectedTab = TabsUtil.activeTab();
switch (selectedTab) {
case 0:
$('input[name="userSe"]').val('GNR');
break;
case 1:
$('input[name="userSe"]').val('ENT');
break;
case 2:
$('input[name="userSe"]').val('USR');
break;
default:
$('input[name="userSe"]').val('');
break;
}
}
}
</script>
<style type="text/css">
.captcha_wrap {
margin-top: 10px;
text-align: right;
}
.captcha_wrap button {
padding: 5px;
font-weight: bold;
margin-left: -70px;
cursor: pointer;
}
.captcha_wrap input[type="text"] {
margin-left: 10px;
height: 45px;
width: 280px;
border: 2px solid #828282;
font-size: 17px;
font-family: Nanumsquare_B;
padding: 0 0 0 10px;
}
#userSeTabs.ui-widget-content {
margin-top: 10px;
border: 0px;
}
#userSeTabs #tabs-0 {
padding: 0px;
margin-top: -38px;
}
#userSeTabs .ui-tabs-nav {
background-color: #fff; /*2021.09.24 박소영 수정 / as-is : background-color: #004988; */
}
</style>
</head>
<body onload="fnInit();">
<div class="login_bg">
<div class="header_wrap">
<h1 class="logo"><img src="<c:url value='/'/>resources/image/fims/framework/login/mainLogo.png" alt="Logo Image"></img></h1>
</div>
<div class="login_text">
<p class="main_img"><img src="<c:url value='/'/>resources/image/fims/framework/login/loginDeco.png" alt=""></img></p>
<div id="userSeTabs">
<ul style="display: none;">
<li><a href="#tabs-0">일반회원</a></li>
<li><a href="#tabs-0">기업회원</a></li>
<li><a href="#tabs-0">업무사용자</a></li>
</ul>
<div id="tabs-0">
<form:form id="loginForm" name="loginForm" method="post">
<div class="input_wrap">
<input type="text" name="id" id="id" title="아이디 입력" class="typeText required form-control inp-long" placeholder="아이디" />
<input type="password" name="passwd" id="passwd" title="비밀번호 입력" class="typePassword required form-control inp-long" placeholder="비밀번호" onkeydown="javascript:if (event.keyCode == 13) { actionLogin(); }"/>
<!-- 캡차인증 -->
<div class="captcha_wrap">
<img id="captchaImg" alt="자동로그인 방지 이미지"/>
<button id="btn_captchaRefresh" alt="자동로그인 방지 이미지 새로고침">새로고침</button>
<input type="text" id="captcha" name="captcha" value="${sessionScope.captcha.answer }" title="자동로그인 방지 문구 입력" placeholder="좌측의 자동로그인 방지 문구 입력"/>
</div>
<!-- //캡차인증 -->
<div class="input_wrap2">
<!-- <label for="idSave"><input type="checkbox" id="idSave" name="idSave"/> ID저장</label> -->
<a href="#" onclick="javascript:fn_FindId(); return false;">아이디 찾기</a>
<a href="#" onclick="javascript:fn_FindPw(); return false;" class="line">비밀번호 찾기</a>
<a href="#" onclick="javascript:fnReg(); return false;" class="line">회원가입</a>
</div>
</div>
<input type="hidden" name="message" value="${message}" />
<input type="hidden" name="userSe" value=""/>
<input name="j_username" type="hidden"/>
</form:form>
<div class="btn_wrap">
<!-- <a href="#" onclick="javascript:fn_MngrInput(); return false;" class="line">회원가입</a> -->
<input type="submit" onclick="javascript:actionLogin()" class="typeButton" title="로그인" value="로그인" />
</div>
</div>
</div>
</div>
</div>
</body>
</html>

@ -43,7 +43,6 @@
<h1 class="logo"><img src="<c:url value='/'/>resources/image/fims/framework/login/mainLogo_02.png" alt="Logo Image"></img></h1>
</div>
<div class="login_text">
<%--<p class="main_img"><img src="<c:url value='/'/>images/login/loginDeco.png" alt=""></img></p>--%>
<p class="main_img"><img src="<c:url value='/'/>resources/image/fims/framework/login/loginDeco_02.png" alt=""></img></p>
<form:form id="loginForm" name="loginForm" method="post">
<div class="input_wrap">

@ -149,6 +149,7 @@ function login() {
}
$(function(){
$("#formAuthentication input").onEnterPress(login);
});
</script>

@ -18,7 +18,6 @@
font-style: normal;
}
/* XitLoginUsr 로그인 */
.login_bg {
background-color: white;
height: 100%;

Loading…
Cancel
Save