Spry

Set password strength

Password strength refers to the degree to which combinations of certain characters match the requirements for a password text field. For example, if you’ve created a form in which users are selecting a password, you might want to force your users to include a certain number of uppercase letters in the password, a certain number of special characters, and so on.

You set options for password strength in the widget constructor. The following table provides a list of options.

Note: By default, none of these options are set for the Password widget.

Option

Description

minChars

The minimum number of characters required for a valid password.

maxChars

The maximum allowable length of the password.

minAlphaChars

Minimum number of letters required for a password to be valid.

maxAlphaChars

Maximum number of letters required for a password to be valid.

minUpperAlphaChars

Minimum number of upper case letters required for a password to be valid.

maxUpperAlphaChars

Maximum number of upper case letters required for a password to be valid.

minSpecialChars

Minimum number of special characters required for a password to be valid.

maxSpecialChars

Maximum number of special characters required for a password to be valid.

minNumbers

Minimum number of numbers required for a password to be valid.

maxNumbers

Maximum number of numbers required for a password to be valid.

Example

<script type="text/javascript">
	var PasswordWidgetObject = new Spry.Widget.ValidationPassword("PasswordWidget", {minAlphaChars;3, maxSpecialChars:2, maxChars:8});
</script>
Note: When combining attributes in a constructor, surround them with curly braces {}, as in the example above.