Active
Project:
LDAP integration
Version:
6.x-1.0-beta2
Component:
User interface
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Jan 2012 at 22:26 UTC
Updated:
6 Jan 2012 at 16:11 UTC
The LDAP module correctly removes the password recovery form, but the error message generated when a local login attempt fails still links to the form.
I fixed it in one of my modules, but for consistency it probably should be included here:
/**
* Implements hook_form_alter
*
* switches user login validator
* so we can change the error message
*/
function mymodule_form_alter(&$form, &$form_state, $form_id){
foreach($form['#validate'] as $key => $function){
if($function == "user_login_final_validate"){
$form['#validate'][$key] = 'mymodule_login_validate';
}
}
}
// validates user login but replaces the error message
function mymodule_login_validate(){
global $user;
if (!$user->uid) {
form_set_error('name', t('Sorry, unrecognized username or password. Please <a href="@contact">contact an administrator</a> if you have forgotten your password.', array('@contact' => url('contact'))));
}
}