|
From: <axe...@us...> - 2010-06-18 12:05:47
|
Revision: 113
http://wpmu-ldap.svn.sourceforge.net/wpmu-ldap/?rev=113&view=rev
Author: axelseaa
Date: 2010-06-18 12:05:40 +0000 (Fri, 18 Jun 2010)
Log Message:
-----------
fixed issue where user data may not have populated correctly on login - also added the start of some debugging options
Modified Paths:
--------------
trunk/ldap/lib/wpmu_ldap.functions.php
trunk/ldap/lib/wpmu_ldap_admin.functions.php
trunk/ldap_auth.php
Modified: trunk/ldap/lib/wpmu_ldap.functions.php
===================================================================
--- trunk/ldap/lib/wpmu_ldap.functions.php 2010-06-16 11:18:43 UTC (rev 112)
+++ trunk/ldap/lib/wpmu_ldap.functions.php 2010-06-18 12:05:40 UTC (rev 113)
@@ -19,6 +19,10 @@
if (!isset($ldapUserData)) $ldapUserData = false;
if (!isset($createBlog)) $createBlog = true;
+ // Check to see if email is empty
+ if ( empty($ldapUserData[LDAP_INDEX_EMAIL]) )
+ return new WP_Error('ldapcreate_emailempty', sprintf(__('<strong>ERROR</strong>: <strong>%s</strong> does not have an email address associated with the ldap record. All wordpress accounts must have a unique email address.'),$newUserName));
+
// Check to see if email already exists
if ( email_exists($ldapUserData[LDAP_INDEX_EMAIL]) )
return new WP_Error('ldapcreate_emailconflict', sprintf(__('<strong>ERROR</strong>: <strong>%s</strong> is already associated with another account. All accounts (including the admin account) must have an unique email address.'),$ldapUserData[LDAP_INDEX_EMAIL]));
@@ -87,7 +91,10 @@
function wpmuLdapAuthenticate($ldapString, $loginUserName, $loginPassword) {
$errors = new WP_Error;
$server = new LDAP_ro($ldapString);
- $server->DebugOff();
+ if (LDAP_DEBUG_MODE) {
+ echo "DEBUG: Attempting to authenticate user: $loginUserName<br/>";
+ $server->DebugOn();
+ } else $server->DebugOff();
// undefined now - going to populate it in $server->Authenticate
$userDataArray = null;
$result = $server->Authenticate ($loginUserName, $loginPassword, $userDataArray);
@@ -96,20 +103,24 @@
}
// handle both at once, for security
else if ( ($result == LDAP_ERROR_USER_NOT_FOUND || $result == LDAP_ERROR_WRONG_PASSWORD) ) {
+ if (LDAP_DEBUG_MODE) echo "DEBUG: Attempting to authenticate user: Wrong user/pass<br/>";
$errors->add('invalid_userpass',__('<strong>ERROR</strong>: Wrong username / password combination.'));
return array('result' => false,'errors' => $errors);
}
// check security group
else if ( $result == LDAP_ERROR_ACCESS_GROUP ){
+ if (LDAP_DEBUG_MODE) echo "DEBUG: Attempting to authenticate user: not found in security group<br/>";
$errors->add('wrong_group',__('<strong>ERROR</strong>: Access denied - user not found in security access group(s).'));
return array('result' => false,'errors' => $errors);
}
elseif ($result == LDAP_ERROR_DENIED_GROUP) {
+ if (LDAP_DEBUG_MODE) echo "DEBUG: Attempting to authenticate user: denied via securtiy groups<br/>";
$errors->add('deny_group',__('<strong>ERROR</strong>: Access denied - user found in security deny group(s).'));
return array('result' => false,'errors' => $errors);
}
// the trickle-through catch-all
else {
+ if (LDAP_DEBUG_MODE) echo "DEBUG: Attempting to authenticate user: unknown error (not user/password or security group based - something else is wrong<br/>";
$errors->add('unknown_error',__('<strong>ERROR</strong>: Unknown error in LDAP Authentication.'));
return array('result' => false,'errors' => $errors);
}
@@ -142,7 +153,7 @@
}
return wpmuLdapCreateWPUserFromLdap(array( 'newUserName' => $loginUserName,
'newUserPassword' => $loginPassword,
- 'userDataArray' => $userDataArray));
+ 'ldapUserData' => $userDataArray));
}
// but if not configured to create 'em, exit with an error
Modified: trunk/ldap/lib/wpmu_ldap_admin.functions.php
===================================================================
--- trunk/ldap/lib/wpmu_ldap_admin.functions.php 2010-06-16 11:18:43 UTC (rev 112)
+++ trunk/ldap/lib/wpmu_ldap_admin.functions.php 2010-06-18 12:05:40 UTC (rev 113)
@@ -578,7 +578,7 @@
</tr>
</table>
- <br/><b>Windows Attributes</b>
+ <br/><b>Windows Specific Attributes</b>
<table class="form-table">
<tr valign="top">
<th scope="row"><label for="ldapAttributeWinSearch">Search Attribute:</label></th>
@@ -603,7 +603,7 @@
</tr>
</table>
- <br/><b>Linux Attributes</b>
+ <br/><b>Linux Specific Attributes</b>
<table class="form-table">
<tr valign="top">
<th scope="row"><label for="ldapAttributeNixSearch">Search Attribute:</label></th>
Modified: trunk/ldap_auth.php
===================================================================
--- trunk/ldap_auth.php 2010-06-16 11:18:43 UTC (rev 112)
+++ trunk/ldap_auth.php 2010-06-18 12:05:40 UTC (rev 113)
@@ -25,6 +25,8 @@
add_action('admin_menu', 'ldap_addmenuuser');
add_action('admin_menu', 'wpmuRemoveAddNewMenu');
+define('LDAP_DEBUG_MODE',false);
+
// perform these filters, actions, and WP function overrides only if LDAP-
// authentication is enabled; this is to cut down on parsing of this code when
// it doesn't apply
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|