Class WPasswordValidator


public class WPasswordValidator extends WRegExpValidator
A validator that checks if a password is valid.

This validator validate an input like a browser supporting the attribute maxlength, minlength, required and pattern would.

  • Constructor Details

    • WPasswordValidator

      public WPasswordValidator()
      Creates a basic password validator.
  • Method Details

    • setMinLength

      public void setMinLength(int chars)
      Specifies the minimum length of the password.

      The default value is 0.

    • getMinLength

      public int getMinLength()
      Returns the minimum length of the password.

      See Also:
    • setInvalidTooShortText

      public void setInvalidTooShortText(CharSequence text)
      Sets the message to display when the password is too small.

      The default value is "Password too small".

    • getInvalidTooShortText

      public WString getInvalidTooShortText()
      Returns the message displayed when the password is too small.

      See Also:
    • setMaxLength

      public void setMaxLength(int chars)
      Specifies the maximum length of the password.

      The default value is std::numeric_limits<int>::max().

    • getMaxLength

      public int getMaxLength()
      Returns the maximum length of the password.

      See Also:
    • setInvalidTooLongText

      public void setInvalidTooLongText(CharSequence text)
      Sets the message to display when the password is too long.

      The default value is "Password too long".

    • getInvalidTooLongText

      public WString getInvalidTooLongText()
      Returns the message displayed when the password is too long.

      See Also:
    • validate

      public WValidator.Result validate(String input)
      Description copied from class: WRegExpValidator
      Validates the given input.

      The input is considered valid only when it is blank for a non-mandatory field, or matches the regular expression.

      Overrides:
      validate in class WRegExpValidator
    • getJavaScriptValidate

      public String getJavaScriptValidate()
      Description copied from class: WValidator
      Creates a Javascript object that validates the input.

      The JavaScript expression should evaluate to an object which contains a validate(text) function, which returns an object that contains the following two fields:

      • fields: a boolean valid,
      • a message that indicates the problem if not valid.

      Returns an empty string if the validator does not provide a client-side validation implementationq.

      Overrides:
      getJavaScriptValidate in class WRegExpValidator
      See Also: