<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet"
	href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
	integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
	crossorigin="anonymous">
<title>사용자 인증</title>
<style type="text/css">
@font-face {
  font-family: NotoSansCJKkr-Medium;
  src: url('/resources/fonts/NotoSansCJKkr-Medium.otf');
}

@font-face {
  font-family: NotoSansCJKkr-Regular;
  src: url('/resources/fonts/NotoSansCJKkr-Regular.otf');
}

body {
	background-color: #e6e1da
}

@media screen and (min-width : 640px) { /* Styles */
	.head {
		width: 500px;
		margin: 0 auto;
	}
	.content {	
		width: 500px;
		margin: 0 auto;
	}
}

.content_option {
	padding-left: 30px;
	padding-right: 30px;
}

input[type=text] {
	border-radius: 3rem;
	margin-bottom: 10px;
	height: 50px;
}

input::placeholder {
	color: #9e8d76;
 	font-size: 20px;
	font-family: NotoSansCJKkr-Regular;
}

.button_option {
	height: 70px;
	border-radius: 3rem;
	margin-bottom: 10px;
	background-color: #9e8d76;
	color: #ffffff;
	font-size: 22px;
}

.title_option {
	font-family: NotoSansCJKkr-Medium;
	color: #000000;
	font-size: 16px;
}

.input_option {
font-family: NotoSansCJKkr-Regular;
	color: #9e8d76;
	font-size: 20px;
	display: block;
    width: 100%;
    height: calc(1.5em + .75rem + 2px);
    padding: .375rem .75rem;
    font-weight: 400;
    line-height: 1.5;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: .25rem;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}


img {
	width: 100%;
}

</style>
</head>
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<script type="text/javascript" language="javascript">
	$(document).ready(function() {

		setInterval(function() {
			alert("시간이 만료되었습니다.");
			history.go(-1);
		}, 180000); // 3000ms(3초)가 경과하면 ozit_timer_test() 함수를 실행합니다.

	});

	function btnClickHandler() {
		var code = $("#code").val();
		if (code == "")
			alert("월패드에 표시된 인증번호를 입력하세요.");
		else {
			console.log(code);
			$.ajax({
						type : "GET",
						url : "/api/oauth2/validate",
						data : {
							code : code
						},
						success : function(data) {
							console.log(data);
							if (data == true) {
								//window.location.href = 'http://127.0.0.1:8003/api/oauth2/code/generate';
								window.location.href = 'https://telproxy.hdc-smart.com/api/oauth2/code/generate';
								//window.location.href = 'https://proxy.hdc-smart.com/api/oauth2/code/generate';
								//window.location.href = 'https://teldev.hdc-smart.com/api/oauth2/code/generate';
							} else {
								alert("인증 실패");
							}
						}
					});

		}
	}
</script>
<body>
	<div class="head">
		<img src="/resources/img/logo.png" />
	</div>
	<!-- <form method="post" action="validate"> -->
	<div class="content content_option">
		<label for="code" class ="title_option">• 인증번호</label> 
		<input type="text" class="input_option"
			id="code" name="code" placeholder="월패드에 뜬 인증번호를 입력하세요." required>
		<input type="button" class="btn button_option btn-block"
			onClick="javascript:btnClickHandler();" value="인증하기" />
	</div>
</body>
</html>