Custom validation formulas
In addition to validation rules based on the security level, you can
define a custom validation formula (rule) to ensure that users' passwords satisfy
your security policy. You must use password
authentication to define a custom validation formula.
To define a custom validation formula:
-
Navigate to the Setup home page:
- From an application page, do one of the following:
- Select Setup Home from the Platform menu.
- Select Setup Home from the application switcher.
- From an application page, do one of the following:
- In the Administration Setup section, click Authentication.
- On the Authentication page, enter the body of a JavaScript function with a single input parameter, password. The function should return an error message for an invalid password or NULL for a valid password.
The following example ensures that the user's password includes at least one special character: '@' or '#':
if (password.indexOf('@')<0 && password.indexOf('#')<0) return "Password must include a special character.";
After specifying your custom validation formula, you can click Debug Formula to find and fix any errors or inconsistencies in the formula.