You are here

function password_policy_admin_validate in Password Policy 7.2

Ctools exportable 'validate' callback.

See also

plugins/export_ui/password_policy.inc

1 string reference to 'password_policy_admin_validate'
password_policy.inc in plugins/export_ui/password_policy.inc
Export UI Ctools plugin for Password Policy module.

File

./password_policy.module, line 165
Enforces password policies.

Code

function password_policy_admin_validate(&$form, &$form_state) {
  if (empty($form_state['policy']->name)) {
    $name = $form_state['values']['name'];
    $dupe_name = db_query('SELECT 1 FROM {password_policy} WHERE LOWER(name) = :new', array(
      ':new' => drupal_strtolower($name),
    ))
      ->fetchField();
    if ($dupe_name) {
      form_set_error('name', t('Duplicate policy name.'));
    }
  }
  return TRUE;
}