FORMULA LANGUAGE


Examples: @PasswordQuality
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.


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.


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.

See Also