function user_pass_validate in Drupal 4
Same name and namespace in other branches
- 5 modules/user/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.module, line 1055 - Enables the user registration and login system.
Code
function user_pass_validate() {
global $form_values;
$name = $form_values['name'];
$mail = $form_values['mail'];
if ($name && !($form_values['account'] = user_load(array(
'name' => $name,
'status' => 1,
)))) {
form_set_error('name', t('Sorry. The username %name is not recognized.', array(
'%name' => theme('placeholder', $name),
)));
}
else {
if ($mail && !($form_values['account'] = user_load(array(
'mail' => $mail,
'status' => 1,
)))) {
form_set_error('mail', t('Sorry. The e-mail address %email is not recognized.', array(
'%email' => theme('placeholder', $mail),
)));
}
else {
if (!$mail && !$name) {
form_set_error('password', t('You must provide either a username or e-mail address.'));
}
}
}
}