PasswordStrengthChecker demo

This page show a passwordStrengthChecker Mixin.
This Mixin can be used to evaluate the strength of password strings.

The mixin displays an instantaneous visual feedback related to the complexity of the password.
You have to provide your own rules to evaluate the password strength.
This demo page use Server-side mode.

Notice the ajax parameter set to true for enable Ajax mode to check the password complexity.
Notice the min parameter, used to set the minimum number of caracters before triggering ajax event.
According to the documentation, the Ajax callback method must return an element of Java PasswordStrengthCheckerTypeEnum enum.

In Action

TML Source code

			<input type="password" t:type="passwordfield" t:id="pwd" 
				   t:mixins="exanpe/PasswordStrengthChecker" t:ajax="true" t:min="2"
				   value="password" />

Java code

    private String password;
    @OnEvent(value = ExanpeEventConstants.PASSWORDSTRENGTHCHECKER_EVENT)
    PasswordStrengthCheckerTypeEnum dummyChecker(String pwd)
        Integer size = pwd.length();
        PasswordStrengthCheckerTypeEnum result = PasswordStrengthCheckerTypeEnum.VERYWEAK;
        if (size >= 3)
            result = PasswordStrengthCheckerTypeEnum.WEAK;
        if (size >= 4)
            result = PasswordStrengthCheckerTypeEnum.STRONG;
        if (size >= 5)
            result = PasswordStrengthCheckerTypeEnum.STRONGEST;
        return result;