@PasswordQuality (Formula Language)

Evaluates the return value of a Password data type field with a number.

Note: This function is new with Release 5.0.1.

Syntax

@PasswordQuality( field_name )

Parameters

field_name

The name of a field with a password data type. The password must be unencrypted.

Return value

passwordQuality

Number. A rating indicating the level of complexity of a password. A high number indicates a complex password that is difficult to decipher.

Usage

This function is supported on the Web.

Note: Using the @PasswordQuality function against a field which has been encrypted using the @Password or @Hashpassword functions will yield incorrect results, as the function will be applied to the encrypted version of the input.

Examples

The first two examples illustrate the unexpected results returned when @PasswordQuality is applied against an encrypted field. The second two examples illustrate the correct way to use @PasswordQuality with password encryption, by placing the password encryption in the document QuerySave event.
  1. In this example, a programmer wanted to modify an existing form that tested for password quality in the input validation formula, so that the password would be encrypted. The programmer added an input translation formula using @Password. Now, a blank password, or a simple password such as "password" with a password quality of 3, returns @Success, which was not the programmer's intent.

    A Password type field, PW, is defined as follows. Input Translation formula: @Password(PW) Input Validation formula: @If(@PasswordQuality(PW)<6;@Failure("Password not complex enough"); @Success)

  2. An agent selects all Person documents where @PasswordQuality(HttpPassword)<8. No documents are selected, because the Person document HttpPassword field is encrypted.
  3. In this example, a form with a password field will be saved repeatedly. The QuerySave event encrypts an unencrypted password of sufficient complexity, but leaves a failed password or already encrypted password alone.

    A Password type field, PW, is defined as follows. Input Translation formula: None Input Validation formula: @If(@PasswordQuality(PW)>7;@Success;@Failure("Password not complex enough")) QuerySave event: FIELD PW:=@If((@PasswordQuality(PW)>7 & @PasswordQuality(PW)<30);@Password(PW);PW) If a password of "password" is entered in the PW field, the Input Validation fails, returning "Password not complex enough". If a password of "a2R5j4K9" is entered in the PW field, the document is saved with the encrypted value of that password in the PW field.

  4. A Password type field, PW, is defined as follows. Input Translation formula: None Input Validation formula: @If(@PasswordQuality(PW)<12;@Failure("Password not complex enough"); @Success) QuerySave event: Dim doc As NotesDocument Set doc=Source.Document res=Evaluate(|@setfield("PW";@Password("PW"))|,doc) Call doc.save(True,True) If a password of "password" is entered in the PW field, the Input Validation fails, returning "Password not complex enough". If a password of "a2R5j4K9" is entered in the PW field, the document is saved with the encrypted value of that password in the PW field.