function _password_policy_constraints in Password Policy 6
Same name and namespace in other branches
- 7 password_policy.module \_password_policy_constraints()
Load contraints inc files.
5 calls to _password_policy_constraints()
- password_policy_admin_form in ./
password_policy.admin.inc - Form display for new or to be edited password policies.
- _password_policy_constraint_description in ./
password_policy.module - Gets the constraint's name and description.
- _password_policy_constraint_error in ./
password_policy.module - Gets the constraint's error message.
- _password_policy_constraint_js in ./
password_policy.module - Gets the javascript code from the constraint to be added to the password validation.
- _password_policy_constraint_validate in ./
password_policy.module - Validates user password. Returns NULL on success or array with error messages from the constraints on failure.
File
- ./
password_policy.module, line 859 - The password policy module allows you to enforce a specific level of password complexity for the user passwords on the system.
Code
function _password_policy_constraints() {
static $_password_policy;
if (!isset($_password_policy)) {
// Save all available constraints in a static variable.
$dir = drupal_get_path('module', 'password_policy') . '/constraints';
$constraints = file_scan_directory($dir, '^constraint.*\\.inc$');
$_password_policy = array();
foreach ($constraints as $file) {
if (is_file($file->filename)) {
include_once $file->filename;
$_password_policy[] = drupal_substr($file->name, 11);
}
}
}
return $_password_policy;
}