You are here

function _password_policy_get_valid_constraints in Password Policy 5

Returns an array of constraint instances which the user should be able to have access to in their password policy. Only the ones which the user sets a value for will be used. See password_policy_form_policy_submit().

Return value

unknown

1 call to _password_policy_get_valid_constraints()
password_policy_form_policy_form in ./password_policy.module

File

./password_policy.module, line 339

Code

function _password_policy_get_valid_constraints() {

  // NOTE: TO ADD A NEW CONSTRAINT
  // Create a new constraint object defined in a constraint_XXX.php file
  // in the constraints directory.  The object should extend the base
  // Constraint object class.  Then add a valid instance to the array
  // below.
  // TODO the constraint objects and the way the UI work only permit
  // one parameter to be passed to the constraint object, which
  // in all cases so far is an integer value representing the minimum
  // number of X that the password is being constrained to.  The values for
  // the constructors do not matter as long as they are valid since they will
  // be overwritten on the form submit.  Ideally we should have a separate
  // UI for each constraint type which can then allow for more complex
  // parameterization of the constraint objects, but so far this hasn't
  // been needed.
  _password_policy_load_constraint_definitions();
  return array(
    new Length_Constraint(1),
    new Letter_Constraint(1),
    new Digit_Constraint(1),
    new Letter_Digit_Constraint(1),
    new Digit_Placement_Constraint(1),
    new Lowercase_Constraint(1),
    new Uppercase_Constraint(1),
    new Punctuation_Constraint(1),
    new History_Constraint(),
    new Character_Types_Constraint(1),
    new Delay_Constraint(1),
    new Username_Constraint(),
  );
}