function user_pass_validate in Drupal 5
Same name and namespace in other branches
- 4 modules/user.module \user_pass_validate()
- 6 modules/user/user.pages.inc \user_pass_validate()
- 7 modules/user/user.pages.inc \user_pass_validate()
File
- modules/
user/ user.module, line 1069 - Enables the user registration and login system.
Code
function user_pass_validate($form_id, $form_values) {
$name = $form_values['name'];
// Blocked accounts cannot request a new password,
// check provided username and email against access rules.
if (drupal_is_denied('user', $name) || drupal_is_denied('mail', $name)) {
form_set_error('name', t('%name is not allowed to request a new password.', array(
'%name' => $name,
)));
}
$account = user_load(array(
'mail' => $name,
'status' => 1,
));
if (!$account) {
$account = user_load(array(
'name' => $name,
'status' => 1,
));
}
if ($account->uid) {
form_set_value(array(
'#parents' => array(
'account',
),
), $account);
}
else {
form_set_error('name', t('Sorry, %name is not recognized as a user name or an email address.', array(
'%name' => $name,
)));
}
}