You are here

function password_policy_load_active_policy in Password Policy 5

Loads the default (enabled and active) policy or NULL if there are no active policies.

Return value

An And_Constraint object instance, or NULL if no active policy exists.

2 calls to password_policy_load_active_policy()
password_policy_cron in ./password_policy.module
Implementation of hook_cron
password_policy_user in ./password_policy.module
The implementation of hook_user(). Used to trap the validation step so we can test any currently enabled password policies.

File

./password_policy.module, line 670

Code

function password_policy_load_active_policy() {
  _password_policy_load_constraint_definitions();
  $result = db_query('SELECT * FROM {password_policy} p WHERE p.enabled = 1');
  if (!$result || !db_num_rows($result)) {
    return NULL;
  }
  $values = db_fetch_array($result);

  // fetch and unserialize the serialized policy
  return unserialize($values['serialized_policy']);
}