function bakery_uncrumble_validate in Bakery Single Sign-On System 7.2
Same name and namespace in other branches
- 6.2 bakery.module \bakery_uncrumble_validate()
- 6 bakery.module \bakery_uncrumble_validate()
Validation for bakery_uncrumble form.
File
- ./
bakery.module, line 1897 - Module file for the Bakery.
Code
function bakery_uncrumble_validate($form, &$form_state) {
// Have to include password.inc for user_check_password().
require_once DRUPAL_ROOT . '/' . variable_get('password_inc', 'includes/password.inc');
// We are ignoring blocked status on purpose.
// The user is being repaired, not logged in.
$account = user_load_by_name($form_state['values']['name']);
if (!($account && $account->uid) || !user_check_password($form_state['values']['pass'], $account)) {
watchdog('bakery', 'Login attempt failed for %user while running uncrumble.', array(
'%user' => $form_state['values']['name'],
));
// Can't pretend that it was the "username or password"
// so let's be helpful instead.
form_set_error('pass', t('Sorry, unrecognized password. If you have forgotten your %site password, please <a href="@contact">contact the site administrator.</a>', array(
'%site' => variable_get('site_name', 'Drupal'),
'@contact' => variable_get('bakery_master', 'http://drupal.org/') . 'contact',
)));
}
else {
$form_state['bakery_uncrumble_account'] = $account;
}
}