Change Password (password strength, password reset)

Source: Internet
Author: User

<meta http-equiv= "x-ua-compatible" content= "Ie=edge"/>
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> Personnel Management-Change Password </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 + +; Contain numbers
if (/[a-z]/.test (O.value)) n + +; Contains lowercase letters
if (/[a-z]/.test (O.value)) n + +; Include uppercase letters
if (/\w/.test (O.value)) n + +; contain other characters
if (o.value.length< 6) n=1; Length less than 5 bits

Switch (n)
{
Case 1:
Aaa= "Password strength: Beginner"; Break
Case 2:
Aaa= "Password strength: Intermediate"; Break
Case 3:
Aaa= "Password strength: Advanced"; Break
Case 4:
Aaa= "Password strength: security level"; 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"/>
<body style= "Text-align:center;" >
<form id= "Form1" runat= "Server" >
<div class= "Password" >
<div class= "PW" >
<div class= "Pw_xiugai" >
Change Password </div>
<div class= "Pw_key" >

<p class= "Pw_tishi" >
<b> Tips:</b> Change your password once a month to improve the security of your password. If you are concerned that the password changes every month will cause you may forget the new password, you can fill in the new password, the same as the original password </p>
</div>
<div style= "Clear:both;" >
</div>
<center>
<p>
<asp:requiredfieldvalidator id= "RequiredFieldValidator3" runat= "Server" controltovalidate= "Txtpwdnew"
Errormessage= "*" ></asp:RequiredFieldValidator> original password: <asp:textbox id= "TXTOLDPASSWD"
runat= "Server" cssclass= "textbox" ></asp:TextBox></p>
<p>
<asp:requiredfieldvalidator id= "RequiredFieldValidator2" runat= "Server" controltovalidate= "Txtpwd"
Errormessage= "*" ></asp:RequiredFieldValidator> New password: <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> Confirm password: <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= "two times input inconsistent! "Font-size=" ></asp:CompareValidator> "Smaller"
<asp:label id= "Label1" runat= "Server" font-size= "Smaller" text= "Password Strength:" 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= "Submit" imagealign= "Absmiddle" onclick= "Btncommit_click"/>&nbsp;
&nbsp; &nbsp;&nbsp;
<asp:imagebutton id= "btnreset" runat= "Server" imageurl= "images/pw_cz.gif" alternatetext= "reset"
Imagealign= "Absmiddle" onclick= "Btnreset_click"/>
</center>
</div>
</div>
<%--<div>
<table cellpadding= "0" cellspacing= "0" border= "1" width= "" height= "275" style= "Background-color: #eef6f9;" Class = "Add_bian" >
<tr>
&LT;TD colspan= "2" height= "245" class= "BMADD_BJ" >
<table cellpadding= "0" cellspacing= "0" border= "0" >
<tr>
&LT;TD valign= "Middle" align= "center" width= "height=" >
<asp:requiredfieldvalidator id= "RequiredFieldValidator2" runat= "Server" controltovalidate= "Txtpwd" errormessage = "*" ></asp:RequiredFieldValidator> new &nbsp;
Password
<asp:textbox id= "txtpwd" runat= "Server" onkeyup= "C ();" Textmode= "Password" bordercolor= "#999999" borderstyle= "Solid" borderwidth= "1px" width= "150px" ></asp:textbox ></td>
</tr>
<tr>
&LT;TD valign= "Middle" align= "center" width= "height=" >
<asp:requiredfieldvalidator id= "RequiredFieldValidator1" runat= "Server" controltovalidate= "Txtpwdnew"
Errormessage= "*" ></asp:RequiredFieldValidator> Confirm password:
<asp:textbox id= "txtpwdnew" runat= "Server" textmode= "Password" bordercolor= "#999999" borderstyle= "Solid" Borderwidth= "1px" width= "150px" ></asp:TextBox>
</td>
</tr>
<tr>
&LT;TD align= "center" style= "HEIGHT:25PX;" >
<asp:comparevalidator id= "CompareValidator1" runat= "Server" controltocompare= "Txtpwd"
Controltovalidate= "Txtpwdnew" display= "Dynamic" errormessage= "two times input inconsistent! "Font-size=" ></asp:CompareValidator> "Smaller"
<asp:label id= "Label4" runat= "Server" font-size= "Smaller" text= "Password Strength:" visible= "False" ></asp:Label>
<asp:label id= "A1" runat= "Server" font-size= "12px" forecolor= "fuchsia" ></asp:Label>
</td>
</tr>
<tr>
&LT;TD align= "center" style= "HEIGHT:19PX" >
<asp:imagebutton id= "Btncommit" runat= "Server" Imageurl= ". /image/tjanj.gif "alternatetext=" Submit "imagealign=" Absmiddle "onclick=" Btncommit_click "/>
<asp:imagebutton id= "btnreset" runat= "Server" Imageurl= ". /image/czan.gif "alternatetext=" reset "imagealign=" Absmiddle "onclick=" Btnreset_click "/>
</td>
</tr>
<tr>
&LT;TD height= "60px" valign= "Top" align= "center" > <asp:label id= "Label1" runat= "Server" forecolor= "Red" text= "" & Gt;</asp:label>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>--%>
<!--hidden Fields--
<asp:hiddenfield id= "Hf_userid" runat= "Server" ></asp:HiddenField>
</form>
</body>

Background code:

#region Load Events
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 Reset Password Aidon and 11-5-9
protected void Btnreset_click (object sender, ImageClickEventArgs e)
{
This.txtPwd.Text = "";
This.txtPwdNew.Text = "";
}
#endregion

#region Determine the password type Aidon 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

Change Password (password strength, password reset)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.