You are here

function bakery_pull_form_validate in Bakery Single Sign-On System 6.2

Same name and namespace in other branches
  1. 7.2 bakery.module \bakery_pull_form_validate()
  2. 7.3 bakery.pages.inc \bakery_pull_form_validate()

Make sure we are not trying to request an existing user.

File

./bakery.module, line 1822

Code

function bakery_pull_form_validate($form, &$form_state) {
  $existing_account = user_load(array(
    'name' => $form_state['values']['name'],
  ));
  if (!$existing_account && $form_state['values']['or_email']) {
    $existing_account = user_load(array(
      'mail' => $form_state['values']['name'],
    ));
  }

  // Raise an error in case the account already exists locally.
  if ($existing_account) {
    form_set_error('name', t('Account !link exists.', array(
      '!link' => theme('username', $existing_account),
    )));
  }
}