You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							41 lines
						
					
					
						
							1.2 KiB
						
					
					
				
			
		
		
	
	
							41 lines
						
					
					
						
							1.2 KiB
						
					
					
				<?php
 | 
						|
/* For licensing terms, see /license.txt */
 | 
						|
/**
 | 
						|
*	Users trying to login, who already exist in the Chamilo database
 | 
						|
*	and have ldap as authentication type get verified here.
 | 
						|
*	@author Roan Embrechts
 | 
						|
*	@package chamilo.auth.ldap
 | 
						|
*/
 | 
						|
/**
 | 
						|
 * An external authentification module needs to set
 | 
						|
 * - $loginFailed
 | 
						|
 * - $uidReset
 | 
						|
 * - $_user['user_id']
 | 
						|
 * - register the $_user['user_id'] in the session
 | 
						|
 *
 | 
						|
 * As the LDAP code shows, this is not as difficult as you might think.
 | 
						|
 * LDAP authentification module
 | 
						|
 * this calls the loginWithLdap function
 | 
						|
 * from the LDAP library, and sets a few
 | 
						|
 * variables based on the result.
 | 
						|
 */
 | 
						|
//require_once('../../inc/global.inc.php'); - this script should be loaded by the /index.php script anyway, so global is already loaded
 | 
						|
 | 
						|
use ChamiloSession as Session;
 | 
						|
 | 
						|
require_once('authldap.php');
 | 
						|
 | 
						|
$loginLdapSucces = ldap_login($login, $password);
 | 
						|
 | 
						|
if ($loginLdapSucces) {
 | 
						|
	$loginFailed = false;
 | 
						|
	$uidReset = true;
 | 
						|
	$_user['user_id'] = $uData['user_id'];
 | 
						|
	Session::write('_uid', $_uid);
 | 
						|
    // Jand: copied from event_login in events.lib.php to enable login statistics:
 | 
						|
	Event::event_login($uData['user_id']);
 | 
						|
} else {
 | 
						|
	$loginFailed = true;
 | 
						|
	unset($_user['user_id']);
 | 
						|
	$uidReset = false;
 | 
						|
}
 | 
						|
 |