Index: authentication_api.php
===================================================================
--- authentication_api.php	(revision 5021)
+++ authentication_api.php	(working copy)
@@ -82,10 +82,16 @@
 		$t_login_method = config_get( 'login_method' );
 
 		if ( false === $t_user_id ) {
-			if ( BASIC_AUTH == $t_login_method ) {
-				# attempt to create the user if using BASIC_AUTH
-				$t_cookie_string = user_create( $p_username, $p_password );
+			if ( BASIC_AUTH == $t_login_method || LDAP == $t_login_method ) {
 
+			    # attempt to create the user if using BASIC_AUTH or LDAP
+			    if ( BASIC_AUTH == $t_login_method) {
+				    $t_cookie_string = user_create( $p_username, $p_password );
+				} elseif ( LDAP == $t_login_method ) {
+					# get the users' email address as well if using LDAP
+					$t_cookie_string = user_create( $p_username, '', ldap_email_from_username( $p_username ) );
+				}
+
 				if ( false === $t_cookie_string ) {
 					# it didn't work
 					return false;
