<%@ 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>