<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="Web.share.login2._default" %>
<%@ Register src="/share/foot.ascx" tagname="foot" tagprefix="uc1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<link rel="stylesheet" href="bootstrap.css"/>
<link rel="stylesheet" href="misc-pages.css"/>
 <script type="text/ecmascript" src="/js/md5.js"></script>
<title></title>
        <script>
            if ((function () {
                var u = navigator.userAgent;
                var b = !!u.match(/AppleWebKit.*Mobile.*/);
                b = b || u.indexOf('Android') > -1 || u.indexOf('Linux') > -1;
                b = b || u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1;
                return b;
            })()) location = '/m/default.aspx';
        </script>
<script type="text/javascript">
    window.onload = function () {

        var oInput = document.getElementById('tbPassword_lan');
        oInput.value = '';
        oInput.onkeyup = function () {
            //强度状态设为默认
            document.getElementById('tbPassword_lan').style.color = "grey";
            var pwd = this.value;
            var result = 0;
            for (var i = 0, len = pwd.length; i < len; ++i) {
                result |= charType(pwd.charCodeAt(i));
            }

            var level = 0;
            //对result进行四次循环，计算其level
            for (var i = 0; i <= 4; i++) {
                if (result & 1) {
                    level++;
                }
                //右移一位
                result = result >>> 1;
            }
            if (pwd.length >= 6) {
                switch (level) {
                    case 1:
                        document.getElementById('tbPassword_lan').style.color = "red";
                        break;
                    case 2:
                        document.getElementById('tbPassword_lan').style.color = "orange";
                        break;
                    case 3:
                        document.getElementById('tbPassword_lan').style.color = "blue";
                        break;
                    case 4:
                        document.getElementById('tbPassword_lan').style.color = "green";
                        break;
                }
            }
        }
    }
    /*
        定义一个函数，对给定的数分为四类(判断密码类型)，返回十进制1，2，4，8
        数字 0001 -->1  48~57
        小写字母 0010 -->2  97~122
        大写字母 0100 -->4  65~90
        特殊 1000 --> 8 其它
    */
    function charType(num) {
        if (num >= 48 && num <= 57) {
            return 1;
        }
        if (num >= 97 && num <= 122) {
            return 2;
        }
        if (num >= 65 && num <= 90) {
            return 4;
        }
        return 8;
    }
</script>
</head>
<body class="simple-page">
	<form action="" method="post" runat ="server">

<div class="simple-page-wrap">
	<div runat ="server" id="biaotiback"></div>

       
	<!-- logo -->
	
	<div class="simple-page-form" id="login-form">
		<h4 class="form-title m-b-xl text-center">请输入用户名和密码</h4>
		
			<div class="form-group">
		   <asp:TextBox ID="tbUserName_lan" runat="server" CssClass="form-control" MaxLength="25" placeholder="人员编号/登录名/邮箱/电话"></asp:TextBox>

			</div>
		
			<div class="form-group">
     <asp:TextBox ID="tbPassword_lan" runat="server" placeholder="请输入密码" autocomplete="off" onblur="cal()" onfocus="c()"
            TextMode="Password"   CssClass="form-control"></asp:TextBox>  

			</div>
		
			<div class="form-group m-b-xl" style ="padding-bottom  :2px;">
					<div style ="float:right ;"><a href ="/m/forget/default.aspx" target ="_blank" >找回密码</a></div>
			<asp:LinkButton ID="lbWechat" runat="server" OnClick="lbWechat_Click"  Visible ="false" >微信登录</asp:LinkButton>
			
			
			</div>
            <asp:LinkButton ID="LinkButton2" runat="server" CssClass="btn btn-primary" ValidationGroup="lan" OnClick="LinkButton2_Click" >登   录</asp:LinkButton>
			
		

	</div>
	
	<div class="simple-page-footer">
		<p>
                           <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                    ControlToValidate="tbUserName_lan" Display="Dynamic" ErrorMessage="请输入登录名。" 
                                    ValidationGroup="lan" ForeColor="Red"></asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                                    ControlToValidate="tbUserName_lan" Display="Dynamic" ErrorMessage="登录名不合规范。" 
                                    ValidationExpression="^[^%&gt;&lt;'&amp;*=!&quot;?]{2,25}$" 
                                    ValidationGroup="lan" ForeColor="Red"></asp:RegularExpressionValidator>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                                    ControlToValidate="tbPassword_lan" Display="Dynamic" ErrorMessage="请输入密码。" 
                                    ValidationGroup="lan" ForeColor="Red"></asp:RequiredFieldValidator>
		</p>
	</div>


</div>
		<div id="footer-a" style ="height :20px;">  <uc1:foot ID="foot1" runat="server" /></div>
		</form>
</body>
</html>


<script type="text/javascript">  
    function cal() {
        var t1 = document.getElementById("<%=tbPassword_lan.ClientID%>").value;
        if (t1.trim().length > 5) {
            var hash = hex_md5(t1);
            var tbcolor = document.getElementById('tbPassword_lan').style.color;
            switch (tbcolor) {
                case 'red':
                    hash = hash + '1';
                    break;
                case 'orange':
                    hash = hash + '2';
                    break;
                case 'blue':
                    hash = hash + '3';
                    break;
                case 'green':
                    hash = hash + '4';
                    break;
            }
            document.getElementById("<%=tbPassword_lan.ClientID%>").value = hash;
        }
        else {
            if (document.getElementById("<%=tbUserName_lan.ClientID%>").value != "")
                alert("请输入正确的密码");
        }
    }
</script>  
<script type="text/javascript">  
    function c() {
        document.getElementById("<%=tbPassword_lan.ClientID%>").value = "";
    }
</script>  