我正在使用密码强度控制来显示用户输入的密码强度。现在在保存用户新密码之前,我想验证密码是否满足复杂性要求或强度控制显示良好。是否有任何密码强度控制属性可以提供密码强度的当前值?
问问题
1924 次
2 回答
2
You can try something like that:
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:TextBox ID="TextBox2" Width="150" TextMode="Password" runat="server" autocomplete="off" onkeypress="getPasswordStrengthState()" /><br />
<asp:Label ID="TextBox2_HelpLabel" runat="server"/><br />
<br />
<ajaxToolkit:PasswordStrength ID="PasswordStrength2" BehaviorID="myPSBID" runat="server" TargetControlID="TextBox2"
DisplayPosition="RightSide" StrengthIndicatorType="BarIndicator" PreferredPasswordLength="15"
HelpStatusLabelID="TextBox2_HelpLabel" StrengthStyles="BarIndicator_TextBox2_weak;BarIndicator_TextBox2_average;BarIndicator_TextBox2_good"
BarBorderCssClass="BarBorder_TextBox2" MinimumNumericCharacters="1" MinimumSymbolCharacters="1"
TextStrengthDescriptions="Very Poor;Weak;Average;Strong;Excellent" RequiresUpperAndLowerCaseCharacters="true" />
<asp:Button ID="Button1" runat="server" Text="Button" style="display:none"/>
<script type="text/javascript" language="javascript">
function getPasswordStrengthState(){
if( $find("myPSBID")._getPasswordStrength()>50){
$get("<%=Button1.ClientID%>").style.display = '';
}
}
</script>
</form>
于 2012-12-05T10:13:29.707 回答
0
[CSS Exemple][1]
<ajaxToolkit:PasswordStrength ID="PS" runat="server"
TargetControlID="TextBox1"
DisplayPosition="RightSide"
StrengthIndicatorType="Text"
PreferredPasswordLength="10"
PrefixText="Strength:"
TextCssClass="TextIndicator_TextBox1"
MinimumNumericCharacters="0"
MinimumSymbolCharacters="0"
RequiresUpperAndLowerCaseCharacters="false"
TextStrengthDescriptions="Very Poor;Weak;Average;Strong;Excellent"
TextStrengthDescriptionStyles="cssClass1;cssClass2;cssClass3;cssClass4;cssClass5
CalculationWeightings="50;15;15;20" />
[1]: http://csharpdotnetfreak.blogspot.com/2012/01/passwordstrength-ajax-aspnet.html
于 2012-12-05T09:17:59.370 回答