function username_enumeration_prevention_pass_validate in Username Enumeration Prevention 7
Same name and namespace in other branches
- 8 username_enumeration_prevention.module \username_enumeration_prevention_pass_validate()
- 6 username_enumeration_prevention.module \username_enumeration_prevention_pass_validate()
Overrides user_pass_validate() found in user.pages.inc.
1 string reference to 'username_enumeration_prevention_pass_validate'
File
- ./
username_enumeration_prevention.module, line 51 - Main file for the Username Enumeration Prevention.
Code
function username_enumeration_prevention_pass_validate($form, &$form_state) {
$name = trim($form_state['values']['name']);
// Try to load by email.
$users = user_load_multiple(array(), array(
'mail' => $name,
'status' => '1',
));
$account = reset($users);
if (!$account) {
// No success, try to load by name.
$users = user_load_multiple(array(), array(
'name' => $name,
'status' => '1',
));
$account = reset($users);
}
if (isset($account->uid)) {
form_set_value(array(
'#parents' => array(
'account',
),
), $account, $form_state);
}
}