1. PasswordCheck

    Article: AN0001637Updated:

    This object provides functions for password strength check. After creating an object with an input password you have several methods for its check.

    Checks return information, whether the check was successfull or not. At the same time there are available corresponding error messages.

    Function GetSummaryErrorMessage returns an overall error message.

     

    Name Description
    bool CheckMinLength(int minLength) Function checks the minimal password length.
    bool CheckMaxLength(int maxLength) Function checks the maximal password length.
    bool CheckMinNonAlphanumericChars(int minCount) Function checks the minimal number of nonalfanumeric characters in the password.
    bool CheckMinUpperChars(int minCount) Function checks the minimal number of upper case characters in the password.
    bool CheckMinLowerChars(int minCount) Function checks the minimal number of lower case characters in the password.
    bool CheckMinSpecChars(int minCount, string specChar) Function checks the minimal number of special (defined) characters in the password.
    bool IsValid() Function returns TRUE if all previously called checks are OK. Otherwise, FALSE is returned.
    string GetSummaryErrorMessage() Function returns an overall error message from all the erroneous checks.
    string ErrorMessageMinLength Error message for check of the minimal password length.
    string ErrorMessageMaxLength Error message for check of the maximal password length.
    string ErrorMessageMinNonAlphanumericChars Error message for check of the minimal number of nonalfanumeric characters in the password.
    string ErrorMessageMinUpperChars Error message for check of the minimal number of upper case characters in the password.
    string ErrorMessageMinLowerChars Error message for check of the minimal number of lower case characters in the password.
    string ErrorMessageMinSpecChars Error message for check of the minimal number of special characters in the password.

    If no check function was called before calling function IsValid, TRUE is returned.

    Function Check... returns TRUE, if the check is OK. It returns FALSE, when the check result does not comply.

    Example

    var password = 'new password';
    var p = OG.TextUtils.CreatePasswordCheck(password);
    p.CheckMaxLength(10);
    p.CheckMinUpperChars(2);

    if ( !p.IsValid())
    {
        //error
        var error = p.GetSummaryErrorMessage();
        ...
    }

×