<head id="Head1" runat="server">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>人事管理-修改密码</title>
<script language="javascript" type="text/javascript">
function checkPassWordLevel(o)
{
o=document.getElementById(o);
var n=0;
var aaa="123" ;
if (/d/.test(o.value)) n ++; //包含数字
if (/[a-z]/.test(o.value)) n ++; //包含小写字母
if (/[A-Z]/.test(o.value)) n ++; //包含大写字母
if (/W/.test(o.value)) n ++; //包含其他字符
if (o.value.length< 6) n=1; //长度小于5位
switch(n)
{
case 1 :
aaa="密码强度:初级"; break;
case 2 :
aaa="密码强度:中级"; break;
case 3 :
aaa="密码强度:高级"; break;
case 4 :
aaa="密码强度:安全级"; break;
default:
break;
}
return aaa;
}
function c()
{
document.getElementById("a1").innerText=checkPassWordLevel("txtPwd");
}
</script>
<link href="Css/pw_update.css" rel="stylesheet" type="text/css" />
</head>
<body style="text-align: center;">
<form id="form1" runat="server">
<div class="password">
<div class="pw">
<div class="pw_xiugai">
修改密码</div>
<div class="pw_key">
<img src="Images/key.gif" />
<p class="pw_tishi">
<b>温馨提示:</b>每个月修改一次密码,可提高密码的安全性。如果您担心密码每个月都修改会导致自己都可能会忘记新密码,您可在填写新密码时,与原来的密码一致</p>
</div>
<div style="clear: both;">
</div>
<center>
<p>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtPwdNew"
ErrorMessage="*"></asp:RequiredFieldValidator>原始密码:<asp:TextBox ID="txtOldPassWd"
runat="server" CssClass="textbox"></asp:TextBox></p>
<p>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtPwd"
ErrorMessage="*"></asp:RequiredFieldValidator>新 密 码:<asp:TextBox ID="txtPwd" runat="server"
onkeyup="c();" TextMode="Password" CssClass="textbox"></asp:TextBox></p>
<p>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtPwdNew"
ErrorMessage="*"></asp:RequiredFieldValidator>确认密码:<asp:TextBox ID="txtPwdNew" runat="server"
TextMode="Password" CssClass="textbox"></asp:TextBox></p>
</center>
<p>
<asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="txtPwd"
ControlToValidate="txtPwdNew" Display="Dynamic" ErrorMessage="两次输入不一致!" Font-Size="Smaller"></asp:CompareValidator>
<asp:Label ID="Label1" runat="server" Font-Size="Smaller" Text="密码强度:" Visible="False"></asp:Label>
<asp:Label ID="a1" runat="server" Font-Size="12px" ForeColor="Fuchsia"></asp:Label>
</p>
<center>
<asp:ImageButton ID="btnCommit" runat="server" ImageUrl="Images/pw_tijiao.gif"
AlternateText="提交" ImageAlign="AbsMiddle" OnClick="btnCommit_Click" />
<asp:ImageButton ID="btnReset" runat="server" ImageUrl="Images/pw_cz.gif" AlternateText="重置"
ImageAlign="AbsMiddle" OnClick="btnReset_Click" />
</center>
</div>
</div>
<%--<div>
<table cellpadding="0" cellspacing="0" border="1" width="400" height="275" style=" background-color:#eef6f9;" class="add_bian">
<tr>
<td colspan="2" height="245" class="bmadd_bj">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td valign="middle" align="center" width="400" height="30">
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtPwd" ErrorMessage="*"></asp:RequiredFieldValidator>新
密 码:
<asp:TextBox ID="txtPwd" runat="server" onkeyup="c();" TextMode="Password" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" Width="150px"></asp:TextBox></td>
</tr>
<tr>
<td valign="middle" align="center" width="400" height="30">
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtPwdNew"
ErrorMessage="*"></asp:RequiredFieldValidator>确认密码:
<asp:TextBox ID="txtPwdNew" runat="server" TextMode="Password" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" Width="150px"></asp:TextBox>
</td>
</tr>
<tr>
<td align="center" style="height:25px;">
<asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="txtPwd"
ControlToValidate="txtPwdNew" Display="Dynamic" ErrorMessage="两次输入不一致!" Font-Size="Smaller"></asp:CompareValidator>
<asp:Label ID="Label4" runat="server" Font-Size="Smaller" Text="密码强度:" Visible="False"></asp:Label>
<asp:Label ID="a1" runat="server" Font-Size="12px" ForeColor="Fuchsia"></asp:Label>
</td>
</tr>
<tr>
<td align="center" style="height: 19px">
<asp:ImageButton ID="btnCommit" runat="server" ImageUrl="../image/tjanj.gif" AlternateText="提交" ImageAlign="AbsMiddle" OnClick="btnCommit_Click" />
<asp:ImageButton ID="btnReset" runat="server" ImageUrl="../image/czan.gif" AlternateText="重置" ImageAlign="AbsMiddle" OnClick="btnReset_Click" />
</td>
</tr>
<tr>
<td height="60px" valign="top" align="center"> <asp:Label ID="Label1" runat="server" ForeColor="Red" Text=" "></asp:Label>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>--%>
<!--隐藏域-->
<asp:HiddenField ID="hf_userId" runat="server"></asp:HiddenField>
</form>
</body>
后台代码:
#region 加载事件
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (!IsPostBack)
{
AjaxPro.Utility.RegisterTypeForAjax(typeof(UpDateUserPassword));
if (Request.QueryString["u_id"] != null)
{
hf_userId.Value = Request.QueryString["u_id"].ToString();
}
else if (Request.Cookies["RSUser"] != null)
{
hf_userId.Value = Convert.ToString(Request.Cookies["RSUser"]["u_id"]);
}
else
{
Response.Write("<script>history.go(-2);</script>");
}
}
}
catch (Exception ex)
{
Page.RegisterStartupScript("", "<script>alert('" + ex.Message + "')</script>");
}
}
#endregion
#endregion
#region 重置密码 艾东 and 11-5-9
protected void btnReset_Click(object sender, ImageClickEventArgs e)
{
this.txtPwd.Text = "";
this.txtPwdNew.Text = "";
}
#endregion
#region 判断密码类型 艾东 and 11-5-7
public bool Panduan()
{
Regex re1 = new Regex(@"d");
Regex re2 = new Regex(@"[a-z]");
Regex re3 = new Regex(@"[A-Z]");
Regex re4 = new Regex(@"W");
int i = 0;
if (re1.IsMatch(txtPwd.Text.Trim()))
{
i++;
}
if (re2.IsMatch(txtPwd.Text.Trim()) == true)
{
i++;
}
if (re3.IsMatch(txtPwd.Text.Trim()) == true)
{
i++;
}
if (re4.IsMatch(txtPwd.Text.Trim()) == true)
{
i++;
}
if (i == 1 || i == 0)
{
return true;
}
return false;
}
#endregion