function bakery_pull_form_validate in Bakery Single Sign-On System 7.3
Same name and namespace in other branches
- 6.2 bakery.module \bakery_pull_form_validate()
- 7.2 bakery.module \bakery_pull_form_validate()
Make sure we are not trying to request an existing user.
File
- ./
bakery.pages.inc, line 135
Code
function bakery_pull_form_validate($form, &$form_state) {
$existing_account = user_load_by_name($form_state['values']['name']);
if (!$existing_account && $form_state['values']['or_email']) {
$existing_account = user_load_by_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', array(
'account' => $existing_account,
)),
)));
}
}