function ldap_authentication_show_reset_pwd in Lightweight Directory Access Protocol (LDAP) 7.2
Same name and namespace in other branches
- 8.2 ldap_authentication/ldap_authentication.module \ldap_authentication_show_reset_pwd()
- 7 ldap_authentication/ldap_authentication.module \ldap_authentication_show_reset_pwd()
2 calls to ldap_authentication_show_reset_pwd()
- _ldap_authentication_form_user_profile_form_alter in ldap_authentication/
ldap_authentication.inc - Alter user editing form (profile form) based on ldap authentication configuration.
- _ldap_authentication_login_form_alter in ldap_authentication/
ldap_authentication.inc - Helper function for ldap_authn_form_user_login_block_alter and ldap_authn_form_user_login_alter.
1 string reference to 'ldap_authentication_show_reset_pwd'
- ldap_authentication_menu_alter in ldap_authentication/
ldap_authentication.module - Implements hook_menu_alter(). since menu items are cached, only useful to add or alter callbacks for ldap authentication driven menu items.
File
- ldap_authentication/
ldap_authentication.module, line 323 - This module injects itself into Drupal's Authentication stack.
Code
function ldap_authentication_show_reset_pwd($user = NULL) {
if (!$user) {
global $user;
}
$auth_conf = ldap_authentication_get_valid_conf();
// Hide user/password form if ldap authentication is required and deny access
// to users without ldap authorizations is enabled.
if ($user->uid == 1 || !$auth_conf || current_path() == 'user/password' && $auth_conf->authenticationMode != LDAP_AUTHENTICATION_EXCLUSIVE) {
return TRUE;
// Always show at user/passwordurl. otherwise user 1 will not be able to reset password.
}
if ($user->uid == 0) {
// Hide reset password for anonymous users if ldap only authentication and password updates are disabled, otherwise show.
if ($auth_conf->authenticationMode == LDAP_AUTHENTICATION_EXCLUSIVE) {
if ($auth_conf->passwordOption == LDAP_AUTHENTICATION_PASSWORD_FIELD_ALLOW) {
return TRUE;
}
return FALSE;
}
return TRUE;
}
else {
// Authenticated user. hide if ldap authenticated and updating password is
// not allowed, otherwise show.
if (ldap_authentication_ldap_authenticated($user)) {
if ($auth_conf->passwordOption == LDAP_AUTHENTICATION_PASSWORD_FIELD_ALLOW) {
return TRUE;
}
return FALSE;
}
return TRUE;
}
}