updated plugin AuthLDAP
version 2.4.10
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
Plugin Name: AuthLDAP
|
||||
Plugin URI: https://github.com/heiglandreas/authLdap
|
||||
Description: This plugin allows you to use your existing LDAP as authentication base for WordPress
|
||||
Version: 2.4.6
|
||||
Version: 2.4.10
|
||||
Author: Andreas Heigl <andreas@heigl.org>
|
||||
Author URI: http://andreas.heigl.org
|
||||
License: MIT
|
||||
@ -296,12 +296,15 @@ function authLdap_login($user, $username, $password, $already_md5 = false)
|
||||
authLdap_debug('LDAP authentication successfull');
|
||||
$attributes = array_values(
|
||||
array_filter(
|
||||
array(
|
||||
$authLDAPNameAttr,
|
||||
$authLDAPSecName,
|
||||
$authLDAPMailAttr,
|
||||
$authLDAPWebAttr,
|
||||
$authLDAPUidAttr
|
||||
apply_filters(
|
||||
'authLdap_filter_attributes',
|
||||
array(
|
||||
$authLDAPNameAttr,
|
||||
$authLDAPSecName,
|
||||
$authLDAPMailAttr,
|
||||
$authLDAPWebAttr,
|
||||
$authLDAPUidAttr
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
@ -380,6 +383,7 @@ function authLdap_login($user, $username, $password, $already_md5 = false)
|
||||
$user_info['user_login'] = $realuid;
|
||||
$user_info['role'] = $role;
|
||||
$user_info['user_email'] = '';
|
||||
$user_info['user_nicename'] = '';
|
||||
|
||||
// first name
|
||||
if (isset($attribs[0][strtolower($authLDAPNameAttr)][0])) {
|
||||
@ -412,7 +416,7 @@ function authLdap_login($user, $username, $password, $already_md5 = false)
|
||||
}
|
||||
}
|
||||
$user_info['user_nicename'] = substr($user_info['user_nicename'], 0, 50);
|
||||
|
||||
|
||||
// optionally store the password into the wordpress database
|
||||
if (authLdap_get_option('CachePW')) {
|
||||
// Password will be hashed inside wp_update_user or wp_insert_user
|
||||
@ -436,6 +440,14 @@ function authLdap_login($user, $username, $password, $already_md5 = false)
|
||||
$userid = wp_insert_user($user_info);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add hook for custom updates
|
||||
*
|
||||
* @param int $userid User ID.
|
||||
* @param array $attribs[0] Attributes retrieved from LDAP for the user.
|
||||
*/
|
||||
do_action('authLdap_login_successful', $userid, $attribs[0]);
|
||||
|
||||
// if the user exists, wp_insert_user will update the existing user record
|
||||
if (is_wp_error($userid)) {
|
||||
authLdap_debug('Error creating user : ' . $userid->get_error_message());
|
||||
@ -848,7 +860,7 @@ function authLdap_set_options($new_options = array())
|
||||
*/
|
||||
function authLdap_send_change_email($result, $user, $newUserData)
|
||||
{
|
||||
if (get_usermeta($user['ID'], 'authLDAP')) {
|
||||
if (get_user_meta($user['ID'], 'authLDAP')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user