[Fusionforge-commits] r8562 - trunk/gforge/plugins/ldapextauth/include

Alain Peyrat aljeux at libremir.placard.fr.eu.org
Fri Dec 18 17:27:10 CET 2009


Author: aljeux
Date: 2009-12-18 17:27:10 +0100 (Fri, 18 Dec 2009)
New Revision: 8562

Modified:
   trunk/gforge/plugins/ldapextauth/include/LdapExtAuthPlugin.class.php
Log:
LdapextauthPlugin: Reactivate account if deleted and use ldap ccode only if valid

Modified: trunk/gforge/plugins/ldapextauth/include/LdapExtAuthPlugin.class.php
===================================================================
--- trunk/gforge/plugins/ldapextauth/include/LdapExtAuthPlugin.class.php	2009-12-18 15:58:34 UTC (rev 8561)
+++ trunk/gforge/plugins/ldapextauth/include/LdapExtAuthPlugin.class.php	2009-12-18 16:27:10 UTC (rev 8562)
@@ -167,6 +167,14 @@
 			if (@ldap_bind($this->ldap_conn, $dn, $raw_passwd)) {
 				debuglog("LDAP: ldap_bind() ok (user bind)");
 				// Password from form is valid in LDAP
+
+				// If account has been deleted but user is valid in LDAP,
+				// then reactivate the account.
+				if ($u->getStatus() == 'D') {
+					debuglog("Account deleted, reactivating it.");
+					$u->setStatus('A');
+				}
+
 				if (session_login_valid_dbonly ($loginname, $passwd, false)) {
 					// Also according to DB
 					$GLOBALS['ldap_auth_failed']=false;
@@ -268,7 +276,10 @@
 					$title = $mappedinfo['title'] ;
 				}
 				if ($mappedinfo['ccode']) {
-					$ccode = $mappedinfo['ccode'] ;
+					$res = db_query("SELECT count(*) as c FROM country_code WHERE ccode='" . $mappedinfo['ccode'] . "'");
+					if (db_result($res, 0, 'c') == 1) {
+						$ccode = $mappedinfo['ccode'] ;
+					}
 				}
 				if ($mappedinfo['themeid']) {
 					$theme_id = $mappedinfo['themeid'] ;




More information about the Fusionforge-commits mailing list