function ldapauth_form_alter in LDAP integration 5.2
Same name and namespace in other branches
- 5 ldapauth.module \ldapauth_form_alter()
- 6 ldapauth.module \ldapauth_form_alter()
File
- ./
ldapauth.module, line 714
Code
function ldapauth_form_alter($form_id, &$form) {
global $user;
if (isset($form['#validate']['user_login_validate'])) {
$form['#validate'] = array(
'ldapauth_login_validate' => array(),
);
}
// Rewrite forms regarding user administration
switch ($form_id) {
case 'user_login_block':
// Since form only available when not logged in, no need to check for admin?
if (variable_get('ldap_disable_request_new_password', FALSE)) {
unset($form['links']);
}
break;
case 'user_pass':
if (variable_get('ldap_disable_request_new_password', FALSE) && variable_get('ldap_user_pass_form', FALSE)) {
$form = array(
'#value' => t(variable_get('ldap_user_pass_form', '<h2>Form disabled by administrator.</h2>')),
);
}
break;
case 'user_edit':
// Remove password change if ldap user
if (variable_get('ldap_disable_user_request_password', FALSE) && $user->ldap_authentified) {
unset($form['account']['pass']);
}
break;
}
}