/*
 * Generated by the Jasper component of Apache Tomcat
 * Version: Apache Tomcat/7.0.47
 * Generated at: 2018-12-26 03:23:04 UTC
 * Note: The last modified time of this file was set to
 *       the last modified time of the source file after
 *       generation to assist with modification tracking.
 */
package org.apache.jsp.WEB_002dINF.views;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;

public final class login_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static final javax.servlet.jsp.JspFactory _jspxFactory =
          javax.servlet.jsp.JspFactory.getDefaultFactory();

  private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;

  private javax.el.ExpressionFactory _el_expressionfactory;
  private org.apache.tomcat.InstanceManager _jsp_instancemanager;

  public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
    return _jspx_dependants;
  }

  public void _jspInit() {
    _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
    _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
  }

  public void _jspDestroy() {
  }

  public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
        throws java.io.IOException, javax.servlet.ServletException {

    final javax.servlet.jsp.PageContext pageContext;
    javax.servlet.http.HttpSession session = null;
    final javax.servlet.ServletContext application;
    final javax.servlet.ServletConfig config;
    javax.servlet.jsp.JspWriter out = null;
    final java.lang.Object page = this;
    javax.servlet.jsp.JspWriter _jspx_out = null;
    javax.servlet.jsp.PageContext _jspx_page_context = null;


    try {
      response.setContentType("text/html; charset=UTF-8");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");
      out.write("<!DOCTYPE html>\r\n");
      out.write("<html>\r\n");
      out.write("<head>\r\n");
      out.write("    <meta charset=\"UTF-8\"/>\r\n");
      out.write("    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\r\n");
      out.write("    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\r\n");
      out.write("    <meta name=\"keywords\" content=\"\"/>\r\n");
      out.write("    <link rel=\"stylesheet\" href=\"../../static/style/base.css\">\r\n");
      out.write("    <link rel=\"stylesheet\" href=\"../../static/style/style.css\">\r\n");
      out.write("    <script src=\"../../static/js/jquery-3.3.1.min.js\"></script>\r\n");
      out.write("\r\n");
      out.write("    <title>登陆</title>\r\n");
      out.write("\r\n");
      out.write("    <script>\r\n");
      out.write("\r\n");
      out.write("        $(document).ready(function () {\r\n");
      out.write("            $(document).keydown(function (event) {\r\n");
      out.write("                if (event.keyCode == 13) {//回车键的键值为13\r\n");
      out.write("                    var toClick = document.getElementById(\"submit\")\r\n");
      out.write("                    toClick.click();  //调用登录按钮的登录事件\r\n");
      out.write("                }\r\n");
      out.write("            });\r\n");
      out.write("            $(\"#imgVerify\").attr(\"src\", \"/getVerify?\" + Math.random());\r\n");
      out.write("\r\n");
      out.write("            function newCode() {\r\n");
      out.write("                var src1 = document.getElementById('imgVerify');\r\n");
      out.write("                src1.src = \"/getVerify?\" + Math.random();\r\n");
      out.write("            }\r\n");
      out.write("\r\n");
      out.write("            //获取验证码\r\n");
      out.write("            $(\"#newCode\").click(function () {\r\n");
      out.write("                $(\"#home\").removeClass(\"hqyzm\");\r\n");
      out.write("                $(\"#home\").addClass(\"hqyzming\");\r\n");
      out.write("                newCode();\r\n");
      out.write("                $(\"#home\").addClass(\"hqyzm\");\r\n");
      out.write("            });\r\n");
      out.write("            //输入框标识\r\n");
      out.write("            var input = $(\"input\");\r\n");
      out.write("            input.focus(function () {\r\n");
      out.write("                $(this).parent().parent().addClass(\"active\");\r\n");
      out.write("            });\r\n");
      out.write("            input.blur(function () {\r\n");
      out.write("                $(this).parent().parent().removeClass(\"active\");\r\n");
      out.write("            });\r\n");
      out.write("\r\n");
      out.write("            //提交表单\r\n");
      out.write("            $(\"#submit\").click(function () {\r\n");
      out.write("                var nameTest = /^.{2,64}$/;\r\n");
      out.write("                var passTest = /^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?![,\\.#%'\\+\\*\\-:;^_`]+$)[,\\.#%'\\+\\*\\-:;^_`0-9A-Za-z]{8,20}$/;\r\n");
      out.write("                var codeTest = /^[A-Za-z]{0,4}$/;\r\n");
      out.write("                var userName = $(\"#userName\").val();\r\n");
      out.write("                var password = $(\"#password\").val();\r\n");
      out.write("                var code = $(\"#code\").val();\r\n");
      out.write("                if (userName === \"\") {alert(\"请输入用户名\");return;}\r\n");
      out.write("                if (password === \"\") {alert(\"请输入密码\");return;}\r\n");
      out.write("                if (code === \"\") {alert(\"请输入验证码\");return;}\r\n");
      out.write("                if (nameTest.test(userName)) {\r\n");
      out.write("                    if (passTest.test(password)) {\r\n");
      out.write("                        if (codeTest.test(code)) {\r\n");
      out.write("                            code = code.toUpperCase();\r\n");
      out.write("                            $.ajax({\r\n");
      out.write("                                type: \"POST\",\r\n");
      out.write("                                url: \"/doLogin\",\r\n");
      out.write("                                dataType: \"json\",\r\n");
      out.write("                                data: {\r\n");
      out.write("                                    userName: userName,\r\n");
      out.write("                                    password: password,\r\n");
      out.write("                                    code: code,\r\n");
      out.write("                                },\r\n");
      out.write("                                success: function (data) {\r\n");
      out.write("                                    if (data.respCode === \"0000\") {\r\n");
      out.write("                                        alert(\"登陆成功\");\r\n");
      out.write("                                        window.location.replace('/');\r\n");
      out.write("                                    }\r\n");
      out.write("                                    if (data.respCode === \"1000\") {\r\n");
      out.write("                                        alert(\"用户名不存在\");\r\n");
      out.write("                                    }\r\n");
      out.write("                                    if (data.respCode === \"1001\") {\r\n");
      out.write("                                        alert(\"密码不正确\");\r\n");
      out.write("                                    }\r\n");
      out.write("                                    if (data.respCode === \"1002\") {\r\n");
      out.write("                                        newCode();\r\n");
      out.write("                                        alert(\"验证码错误\");\r\n");
      out.write("                                    }\r\n");
      out.write("\r\n");
      out.write("                                }\r\n");
      out.write("                            });\r\n");
      out.write("                        }\r\n");
      out.write("                        else {\r\n");
      out.write("                            alert(\"验证码格式错误\");\r\n");
      out.write("                        }\r\n");
      out.write("                    } else {\r\n");
      out.write("                        alert(\"密码不符合要求 \" + '\\n' +\r\n");
      out.write("                            \"必须包含数字字母字符任意两项\" + '\\n' + \"长度大于8\");\r\n");
      out.write("                    }\r\n");
      out.write("                } else {\r\n");
      out.write("                    alert(\"用户名中非法\");\r\n");
      out.write("                }\r\n");
      out.write("            });\r\n");
      out.write("        });\r\n");
      out.write("    </script>\r\n");
      out.write("</head>\r\n");
      out.write("<body>\r\n");
      out.write("<div class=\"wrap\">\r\n");
      out.write("    <form href=\"doLogin\" method=\"post\">\r\n");
      out.write("        <div class=\"login-form\">\r\n");
      out.write("            <ul>\r\n");
      out.write("                <li id=\"a\">\r\n");
      out.write("                    <label>用户名</label>\r\n");
      out.write("                    <div>\r\n");
      out.write("                        <input type=\"text\" name=\"password\" id=\"userName\" placeholder=\"要登陆的群 群名\">\r\n");
      out.write("                    </div>\r\n");
      out.write("                </li>\r\n");
      out.write("                <li id=\"b\">\r\n");
      out.write("                    <label>密码</label>\r\n");
      out.write("                    <div>\r\n");
      out.write("                        <input type=\"password\" name=\"password\" id=\"password\" placeholder=\"最少8位,且必须有数字、字母、符号\">\r\n");
      out.write("                    </div>\r\n");
      out.write("                </li>\r\n");
      out.write("                <li id=\"c\">\r\n");
      out.write("                    <label>验证码</label>\r\n");
      out.write("                    <span>\r\n");
      out.write("                        <img id=\"imgVerify\" src=\"\" alt=\"获取验证码失败\" width=\"95\" height=\"25\"/>\r\n");
      out.write("\t\t\t\t\t</span>\r\n");
      out.write("                    <div>\r\n");
      out.write("                        <input type=\"text\" name=\"code\" id=\"code\">\r\n");
      out.write("                        <a class=\"hqyzm\" id=\"newCode\">获取验证码</a>\r\n");
      out.write("                    </div>\r\n");
      out.write("                </li>\r\n");
      out.write("            </ul>\r\n");
      out.write("        </div>\r\n");
      out.write("    </form>\r\n");
      out.write("    <div class=\"log\">\r\n");
      out.write("        <a id=\"submit\">登陆</a>\r\n");
      out.write("    </div>\r\n");
      out.write("    <div class=\"log-more\">\r\n");
      out.write("        <a class=\"btn-reg\" href=\"/logon\">马上注册&nbsp;&nbsp;</a>|\r\n");
      out.write("        <a class=\"btn-psw\" href=\"\">&nbsp;&nbsp;忘记密码</a>\r\n");
      out.write("    </div>\r\n");
      out.write("</div>\r\n");
      out.write("</body>\r\n");
      out.write("</html>\r\n");
    } catch (java.lang.Throwable t) {
      if (!(t instanceof javax.servlet.jsp.SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try { out.clearBuffer(); } catch (java.io.IOException e) {}
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
        else throw new ServletException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}
