<%--
  Class Name : EgovLoginUsr.jsp
  Description : 로그인화면
  Modification Information

      수정일         수정자                   수정내용
    -------    --------    ---------------------------
     2009.03.10    박지욱             최초 생성
     2011.08.31   JJY       경량환경 버전 생성

    author   : 공통서비스 개발팀  박지욱
    since    : 2009.03.10
--%>
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="kc" uri="/WEB-INF/tlds/kcc_tld.tld"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta http-equiv="Content-Language" content="ko">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>로그인</title>
<script src="/kccadrPb/usr/script/jquery-3.5.0.js"></script>
<script type="text/javascript" src="/js/new_login.js"></script>


<link rel="stylesheet" href="/kccadrPb/adm/css/reset.css">
<link rel="stylesheet" href="/kccadrPb/adm/css/font.css">
<link rel="stylesheet" href="/kccadrPb/adm/css/common.css">
<link rel="stylesheet" href="/kccadrPb/adm/css/content.css">
<link rel="stylesheet" href="/kccadrPb/adm/css/content_media.css">

<script type="text/javascript">
$( document ).ready(function(){
	<c:if test="${!empty message}">alert("${message}");</c:if>
	getid(document.loginForm);
});

function actionLogin() {
    if (document.loginForm.id_text.value =="") {
        alert("아이디를 입력하세요");
        return false;
    } else if (document.loginForm.password_text.value =="") {
        alert("비밀번호를 입력하세요");
        return false;
    }    
    else {
        var id = $("#id_text").val();
        var pw = $("#password_text").val();

		$("#id").val(id);
        $("#password").val(pw);
        $("#password2").val(pw);
        
        document.loginForm.action="<c:url value='/uat/uia/actionSecurityLoginCourt.do'/>";
        saveid(document.loginForm);
        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 "";
}

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("ncms_saveid", form.id_text.value, expdate);
}

function getid(form){
    form.checkId.checked = ((form.id_text.value = getCookie("ncms_saveid")) != "");
}

function validation(){
	if(document.loginForm.phone.value == ''){
		alert('휴대폰번호를 입력해주세요.');
		return false;
	}
	return true;
}
</script>

</head>
<body>
	<form:form id="loginForm" name="loginForm" method="post">
		<input type="hidden" name="userSe" value="USR" />
		<input type="hidden" id="id" name="id">
		<input type="hidden" id="password" name="password">
		<input type="hidden" id="password2" name="password2">

		<input name="j_username" type="hidden" />
		<div class="login_all_wrap">
			<div class="login_wrap">
				<div class="login_left_box">
					<img src="/kccadrPb/adm/image/login_logo.png" alt="한국저작권위원회 KOREA COPYRIGHT COMMISSION">
				</div>
				<div class="login_right_box login_right_otp_box">
					<p class="login_tit">법원연계 - 조정위원 로그인</p>
					<div class="id_box">
						<p>ID</p>
						<label for="id_text"></label>
						<input type="text" id="id_text" maxlength="15" placeholder="아이디를 입력해주세요" class="id">
					</div>
					<div class="pw_box">
						<p>PASSWORD</p>
						<label for="password_text"></label>
						<input type="password" autocomplete="off" id="password_text" value="<c:out value='${password}'/>" placeholder="비밀번호를 입력해주세요." class="pw" onkeydown="javascript:if (event.keyCode == 13) { actionLogin();return false; }">
					</div>
					<div class="saveId">
						<input type="checkbox" id="checkId" name="checkId">
						<label for="checkId">아이디저장</label>
					</div>
					<div class="submit_box">
						<input type="submit" value="로그인" class="submit" id="login_submit" onclick="javascript:actionLogin();return false;">
						
					</div>
					<div class="copyright">
						<span class="copy_text">Copyright ⓒ한국저작권위원회 All Rights Reserved.</span>
					</div>
				</div>
			</div>
		</div>
	</form:form>
	
	<form id="certForm" name="certForm" method="post" action="">
		<input type="hidden" name="userId" id="userId" value="<c:out value='${id}'/>"/>
		<input type="hidden" name="trPhone" id="trPhone" value=""/>
		
	</form>
</body>
</html>
