<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="m_firstlogin.aspx.cs" Inherits="Web.m.m_firstlogin" %>

<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
    <title>OA标题页</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link type="text/css" rel="stylesheet" href="/css/reset.css" />
<link type="text/css" rel="stylesheet" href="/css/base.css" />
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/ecmascript" src="/js/md5.js"></script>
<style type="text/css">
   #newsArticle img{width:100%!important;height:auto!important;max-width:640px;}
  </style>
        <style type="text/css">
        .default {display: inline-block;width: 40px;height: 30px;line-height: 30px;background: #ddd;text-align: center;margin: 4px 2px;background: grey;}
        .weak {display: inline-block;width: 40px;height: 30px;line-height: 30px;background: #ddd;text-align: center;margin: 4px 2px;background: red;}
        .medium {display: inline-block;width: 40px;height: 30px;line-height: 30px;background: #ddd;text-align: center;margin: 4px 2px;background: orange;}
        .strong {display: inline-block;width: 40px;height: 30px;line-height: 30px;background: #ddd;text-align: center;margin: 4px 2px;background: blue;}
        .stronger {display: inline-block;width: 40px;height: 30px;line-height: 30px;background: #ddd;text-align: center;margin: 4px 2px;background: green;}
        .spana {display: inline-block;width: 40px;height: 30px;line-height: 30px;background: #ddd;text-align: center;margin: 4px 2px;}
        </style>
      <script type="text/javascript">
          window.onload = function () {

              var oInput = document.getElementById('tbEditPassword1');
              oInput.value = '';
              oInput.onkeyup = function () {
                  //强度状态设为默认
                  span0.className = span1.className = span2.className = span3.className = "default";
                  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:
                              span0.className = "weak";
                              break;
                          case 2:
                              span0.className = "medium";
                              span1.className = "medium";
                              break;
                          case 3:
                              span0.className = "strong";
                              span1.className = "strong";
                              span2.className = "strong";
                              break;
                          case 4:
                              span0.className = "stronger";
                              span1.className = "stronger";
                              span2.className = "stronger";
                              span3.className = "stronger";
                              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="bg2">
    <form id="fom" runat="server">
    <section id="container">
    <div class="space-10"></div>
    <section class="bg-fff pad9 marLR9 opacity summary">
      <h3 class="color-black bold lineH17 padLR3"> 
      <!--此处添加标题（小字）-->
      <asp:Label ID="lbbiaoti" runat="server" ></asp:Label> 
      	</h3>
    <div class="space-10"></div>
        <h2 class="f17 color-black bold lineH22 padLR3">
        <!--此处添加标题（大字）-->

        </h2>
        <div class="padLR3 oh"><span class="fr pointer fontSize" id="fontSize">大字</span></div>
        <article class="newsArticle" id="newsArticle">
            <div class="tc onePic">
          </div>
            <div class="color-black padLR6 marB5">
   <!--此处添加正文-->
   <table  style =" width :100%" border = "1"  cellpadding ="0" cellspacing ="0" >
                <tr>
                    <td class =" rh30 " colspan="2" style =" text-align :center ">
                        <div style =" font-size :large ; font-weight :bold ">第一次登录请修改信息</div>
                        <asp:Label ID="lbDepartment" runat="server"></asp:Label>
                        ：<asp:Label ID="lbEditLoginId" runat="server"></asp:Label>
                                                       &nbsp;<asp:Label ID="lbEditName" runat="server"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td class ="rh30 " style ="padding-top :10px; padding-bottom :10px; text-align :center ; width:100px;" >登 录 名</td>
                    <td class ="rh30 ">
                        <asp:TextBox ID="tbEditLoginName" runat="server" MaxLength="20" width="98%"
                            Height="24px"></asp:TextBox>
                     
                    </td>
                </tr>
                <tr>
                    <td class ="rh30" style ="padding-top :10px; padding-bottom :10px; text-align :center; width:100px;">新 密 码</td>
                    <td class ="rh30">
                         <asp:TextBox ID="tbEditPassword1" runat="server" onblur="cal()" onfocus="c()"
                                 TextMode="Password" Height="24px" width="98%"></asp:TextBox> 
                    
                           
                      
                         <div id="psdnote" runat="server" style="padding-top :10px">
                             密码不少于6位，密码中小写字母、大写字母、数字和符号4类字符中至少有<asp:Label ID="lbPsdL" runat="server">1</asp:Label>类。
                  </div>
                 <div id="Div1" runat="server" style="padding-top :10px">
                                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                                    ControlToValidate="tbEditPassword1" Display="Dynamic" ErrorMessage="请填写密码" 
                                    ValidationGroup="Edit" ForeColor="Red"></asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                                    ControlToValidate="tbEditPassword1" Display="Dynamic" ErrorMessage="密码不合规范" 
                                    ValidationExpression="\w{6,50}" 
                                    ValidationGroup="Edit" ForeColor="Red"></asp:RegularExpressionValidator>   
                    </div>
                           
                      
                    </td>
                </tr>
                <tr>
                    <td class ="rh30" style ="padding-top :10px; padding-bottom :10px; text-align :center; width:100px;">密码强度</td>
                    <td class ="rh30">
                         <span id="span0" class ="spana">弱</span><span id="span1"  class ="spana">中</span><span id="span2"  class ="spana">强</span><span id="span3"  class ="spana">极强</span>
</td>
                </tr>
                <tr>
                    <td class ="rh30" style ="padding-top :10px; padding-bottom :10px; text-align :center; width:100px;">重复密码</td>
                    <td class ="rh30">
                        <asp:TextBox ID="tbEditPassword2" runat="server" onblur="cal2()" onfocus="c2()" width="98%"
                            TextMode="Password" Height="24px"></asp:TextBox>
                       <div id="Div2" runat="server" style="padding-top :10px">
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" 
                                    ControlToValidate="tbEditPassword2" Display="Dynamic" ErrorMessage="请再填一次密码" 
                                    ValidationGroup="Edit" ForeColor="Red"></asp:RequiredFieldValidator>
                        <asp:CompareValidator ID="CompareValidator1" runat="server" 
                            ControlToCompare="tbEditPassword1" ControlToValidate="tbEditPassword2" 
                            Display="Dynamic" ErrorMessage="两次输入不一致" ForeColor="Red" 
                            ValidationGroup="Edit"></asp:CompareValidator>

                       </div>
                     </td>
                </tr>
                <tr>
                    <td class ="rh30" style ="padding-top :10px; padding-bottom :10px; text-align :center; width:100px;">电&nbsp;&nbsp;&nbsp;&nbsp; 话</td>
                    <td class ="rh30 ">
                        <asp:TextBox ID="tbTel" runat="server" MaxLength="20" Height="24px" width="98%"></asp:TextBox> 
                    </td>
                </tr>
                <tr>
                    <td class ="rh30" style ="padding-top :10px; padding-bottom :10px; text-align :center; width:100px;">邮&nbsp;&nbsp;&nbsp;&nbsp; 箱</td>
                    <td class ="rh30 ">
                        <asp:TextBox ID="tbEditEmail" runat="server" width="98%"
                            MaxLength="100" Height="24px"></asp:TextBox>
                                                        </td>
                </tr>
                <tr>
                    <td class ="rh30 " style ="padding-top :10px; padding-bottom :10px; text-align :center " colspan="2">
        <asp:Label ID="lbEditId" runat="server" Visible="False"></asp:Label>
                        <asp:Button ID="btEdit" runat="server" onclick="btEdit_Click" Text="提交修改" 
                            ValidationGroup="Edit" Height="24px" Width="80px" />
                 <asp:Label ID="lbPsdErr" runat="server" ForeColor ="Red" ></asp:Label>     
                        <div>

                        <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" 
                            ControlToValidate="tbEditLoginName" Display="Dynamic" ErrorMessage="登录名不能为空。" 
                            ValidationGroup="Edit" ForeColor="Red"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator5" runat="server" 
                        ControlToValidate="tbEditLoginName" Display="Dynamic" 
                        ErrorMessage="登录名为2-20个数字或字母。" 
                        ValidationExpression="^[^%&gt;&lt;'&amp;*=!&quot;?]{2,20}" 
                        ValidationGroup="Edit" ForeColor="Red"></asp:RegularExpressionValidator>

                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                            ControlToValidate="tbTel" Display="Dynamic" ErrorMessage="电话不能为空。" 
                            ValidationGroup="Edit" ForeColor="Red"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator15" 
                        runat="server" ControlToValidate="tbTel" Display="Dynamic" 
                        ErrorMessage="请输入正确的电话号码。" 
                        ValidationExpression="(\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$" 
                        ValidationGroup="Edit" ForeColor="Red"></asp:RegularExpressionValidator>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                            ControlToValidate="tbEditEmail" Display="Dynamic" ErrorMessage="邮箱不能为空。" 
                            ValidationGroup="Edit" ForeColor="Red"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator14" 
                        runat="server" ControlToValidate="tbEditEmail" Display="Dynamic" 
                        ErrorMessage="请输入正确的邮箱。" 
                        ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*.[a-zA-Z0-9]{2,7}" 
                        ValidationGroup="Edit" ForeColor="Red"></asp:RegularExpressionValidator>

                        </div>
                    </td>
                </tr>
            </table>
   <!--正文结束-->     
           </div>
        </article>
            <div class="space-20"></div>
        <div class="space-30">
                <div class="mhome">
                    </div>
        <div  class ="mexit">
            <asp:ImageButton ID="imgBExit" runat="server" ImageUrl="/css/images/exit.png" 
                Height="30px" Width="30px" onclick="imgBExit_Click"></asp:ImageButton></div>
        </div>
       
  
    </section><!--summary end-->
    <div class="space-20"></div>
</section><!--container end-->
<script type="text/javascript" src="/js/base.js"></script>
        </form>
    </body>
</html>

<script type="text/javascript">  
    function cal() {
        document.getElementById("<%=lbPsdErr.ClientID%>").innerText = "";
        document.getElementById("btEdit").removeAttribute("disabled");

        var t1 = document.getElementById("<%=tbEditPassword1.ClientID%>").value;
        if (t1.trim().length > 5) {
            var PsdL = document.getElementById("<%=lbPsdL.ClientID%>").innerText;
            switch (PsdL) {
                case 2:
                    if (span0.className == "weak") {
                        document.getElementById("<%=lbPsdErr.ClientID%>").innerText = "密码强度不够。";
                        document.getElementById("btEditPasswordOK").setAttribute("disabled", true);
                    }
                    break;
                case 3:
                    if (span0.className == "weak" || span0.className == "medium") {
                        document.getElementById("<%=lbPsdErr.ClientID%>").innerText = "密码强度不够。";
                        document.getElementById("btEditPasswordOK").setAttribute("disabled", true);
                    }
                    break;
                case 4:
                    if (span0.className == "weak" || span0.className == "medium" || span0.className == "stronger") {
                        document.getElementById("<%=lbPsdErr.ClientID%>").innerText = "密码强度不够。";
                        document.getElementById("btEditPasswordOK").setAttribute("disabled", true);
                    }
                    break;
            }
            document.getElementById("<%=tbEditPassword1.ClientID%>").value = hex_md5(t1);
        }
        else {
            document.getElementById("<%=lbPsdErr.ClientID%>").innerText = "密码不足6位。";
            document.getElementById("btEdit").setAttribute("disabled", true);
        }
    }

</script>  
<script type="text/javascript">  
    function c() {
        document.getElementById("<%=tbEditPassword1.ClientID%>").value ="";
    }
</script>  


<script type="text/javascript">  
    function cal2() {
        var t1 = document.getElementById("<%=tbEditPassword2.ClientID%>").value;
        document.getElementById("<%=tbEditPassword2.ClientID%>").value = hex_md5(t1);
    }
</script>  
<script type="text/javascript">  
    function c2() {
        document.getElementById("<%=tbEditPassword2.ClientID%>").value = "";
    }
</script>  














