Description
The passwordStrength component is needed by the web sites which ask the user to enter a powerful password for the purpose of the registration stuff.
The component enables its user to know the strength of the password while (he/she) types it before even submit the form to the server [please see the screenshots].
The component enables its user to define his custom security policy for his password in an easy manner.
The component also have 2 types of presenting the password strength. Till now the strength can be represented as text or progressbar.
API
author | Hazem Ahmed Saleh |
component-family | org.apache.myfaces.PasswordStrength |
renderer-type | org.apache.myfaces.PasswordStrength |
component-class | org.apache.myfaces.custom.passwordStrength.PasswordStrengthComponent |
renderer-class | org.apache.myfaces.custom.passwordStrength.PasswordStrengthRenderer |
tag-class | org.apache.myfaces.custom.passwordStrength.PasswordStrengthTag |
Usage
<s:passwordStrength [id="txtPwdText"] [preferredPasswordLength="10"] [value="#{passwordStrengthBean.password}"] [prefixText="Strength : "] [textStrengthDescriptions="Very Poor;Weak;Average;Strong;Excellent"] [strengthIndicatorType="text|bar"] [useCustomSecurity="true|false"] [customSecurityExpression="A3S2N3A2"] [penaltyRatio="50"]> </s:passwordStrength>
Instructions
id - defines the id of the component.
preferredPasswordLength - defines the preferred length of the password. It is required.
textStrengthDescriptions - defines the text strength descriptions that defines the strength levels.
It is optional.
Default is "Very Poor;Weak;Average;Strong;Excellent" (5 levels).
prefixText - The prefix of the textStrengthDescriptions message.
It is optional.
Default is "Strength : "
showDetails - This flag {true | false} determines whether to show the details "The Left Characters" or not.
It is optional.
Default is true.
strengthIndicatorType - This flag {true | false} determines the strength indicator type. It can be {text | bar}.
It is optional.
Default is text.
useCustomSecurity - This flag {true | false} determines whether to use custom security rule instead of just depending on the password length or not.
It is optional.
Default is false.
customSecurityExpression -
This string determines the expression of the custom security policy of the password
Note that the expression has the following simple format :
*******************************************************
S (Number) N (Number) A (Number)
Where S stands for Symbols
Where N stands for Numbers
Where A stands for Alphabets
*******************************************************
For example) A4N2S3A2
Means that the password will be as following :
4 or more Alphabets followed by
2 or more Numbers followed by
3 or more Symbols followed by
2 or more Alphabets
*******************************************************
Note that the useCustomSecurity should be set to true to activate this attribute.
penaltyRatio -
This attribute determines the penalty ratio that will decrease the password
Strength if the custom security expression is not met.
Possible values from 0 to 100.
Default value is 50.
Note that the useCustomSecurity should be set to true to activate this attribute.