[SUCS Devel] site r644 - branches/sucs-site/lib

imranh at sucs.org imranh at sucs.org
Mon Feb 2 10:55:24 GMT 2015


Author: imranh
Date: 2015-02-02 10:55:23 +0000 (Mon, 02 Feb 2015)
New Revision: 644

Modified:
   branches/sucs-site/lib/ldap-auth.php
Log:
Update to fix email detectin becuase "very.unusual. at .unusual.com"@example.com is apprently a vlaid email wtf



Modified: branches/sucs-site/lib/ldap-auth.php
===================================================================
--- branches/sucs-site/lib/ldap-auth.php	2015-02-02 10:32:09 UTC (rev 643)
+++ branches/sucs-site/lib/ldap-auth.php	2015-02-02 10:55:23 UTC (rev 644)
@@ -36,8 +36,12 @@
 		// people like to use emails to login so lets detect and strip
 		if(filter_var($username, FILTER_VALIDATE_EMAIL)){
 			//valid email, lets strip
-			$parts = explode("@", $username);
-			$username = $parts[0];
+			// split the email into a string array "@" as a delim
+			$s = explode("@",$username);
+			// remove the last element (domain)
+			array_pop($s);
+			// put the array back togther using "@" as a seperator
+			$username = implode("@",$s);
 		}
 
 		// ldap servers




More information about the Devel mailing list