<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
    <title><spring:message code="user.reset.title"/></title>
    <meta name="decorator" content="default"/>
    <%@include file="/WEB-INF/views/include/head.jsp" %>
    <link rel="stylesheet" href="${ctxStatic}/common/login.css">
	<style type="text/css">
	.right {
	padding: 45px 130px;
	}     
     </style>
    <script type="text/javascript">
        $(document).ready(function () {
            <!--针对nw.js评卷客户端，自动窗口最大化-->
            try {
                require('nw.gui').Window.get().maximize();
            } catch (e) {
            }
            var nameVerify =${nameVerify};
            $('#submit-button').click(function () {
                var name = $('#loginName').val();
                if (name == '') {
                    showError($.i18n.prop("user.reset.name"));
                    return false;
                }
                if (name.length > 10) {
                    showError($.i18n.prop("user.reset.name.length"));
                    return false;
                }
                if (nameVerify == true) {
                    //var reg = new RegExp("[\\u4E00-\\u9FFF]+");
                    var pattern = /^[\u4E00-\u9FFF]{1,10}$/;
                    if (!pattern.test(name)) {
                        showError($.i18n.prop("user.reset.name.chinese"));
                        return false;
                    }
                }

                var password = $('#password').val();
                var password2 = $('#password2').val();
                if (password == '') {
                    showError($.i18n.prop("user.reset.password"));
                    return false;
                }
                if (password.length > 12 || password.length < 6) {
                    showError($.i18n.prop("user.reset.password.length"));
                    return false;
                }
                if (password != password2) {
                    showError($.i18n.prop("user.reset.password.same"));
                    return false;
                }
                return true;
            });
        });

        function showError(message) {
            $('.point').show();
            $('.error').html(message);
        }

        // 如果在框架中，则跳转刷新上级页面
        if (self.frameElement && self.frameElement.tagName == "IFRAME") {
            parent.location.reload();
        }
        load();
    </script>
</head>
<body>
<div class="container">
    <div class="middle cl">
        <div class="left">
            <%-- <div class="logo"><img src="${ctxStatic}/images/<c:if test="${indexLogo ==null||indexLogo =='' }">logo@2x.png</c:if><c:if test="${indexLogo !=null }">${indexLogo }</c:if>"/></div> --%>
            <a target="_blank" style="color: rgba(255,255,255,.65)"><p>v${versionName} beta${versionDate}</p></a>
        </div>
        <div class="right">
            <div class="title">
                <h1 data-i18n-text="user.reset.title">首次登录，请完善资料</h1>
                <br/>
            </div>
            <div class="loginbox">
                <form action="${ctx}/mark/reset" method="post" role="form" id="loginForm">
                    <div class="input-group">
                    	<img src="${ctxStatic}/images/userid.png" class="input-icon">
                        <input type="text" class="form-control required" id="loginName" name="name" placeholder="请输入姓名" autocomplete="off" value="${loginName }"
                               data-i18n-placeholder="user.reset.name"/>
                    </div>
                    <div class="input-group input-top">
                    	<img src="${ctxStatic}/images/empno.png" class="input-icon">
                        <input type="text" class="form-control required" id="empno" name="empno" placeholder="请输入工号" autocomplete="off"/>
                    </div>
                    <div class="input-group input-top">
                   		 <img src="${ctxStatic}/images/password.png" class="input-icon">
                        <input type="password" class="form-control required" id="password" name="password" placeholder="请输入6位以上新密码" autocomplete="off" data-i18n-placeholder="user.reset.password"/>
                    </div>
                    <div class="input-group input-top">
                    	<img src="${ctxStatic}/images/password.png" class="input-icon">
                        <input type="password" class="form-control required" id=password2 name="password2" placeholder="再次输入密码" autocomplete="off" data-i18n-placeholder="user.reset.password.again"/>
                    </div>
                    <div class="point <c:if test="${message == null }">hide</c:if>">
                        <em class="error">${message }</em>
                    </div>
                    <div class="login-btn">
                        <input class="opacity" type="submit" id="submit-button" value="确 定" data-i18n-value="user.reset.submit"/>
                        <a href="${ctx}/logout" class="opacity" data-i18n-text="user.reset.logout">退 出</a>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
</body>
</html>