| Versions | |
|---|---|
| 4.7 | user_pass_validate() |
| 5 | user_pass_validate( |
| 6 – 7 | user_pass_validate($form, &$form_state) |
modules/
<?php
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.'));
}
}
?>