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

imranh at sucs.org imranh at sucs.org
Mon Feb 2 10:32:12 GMT 2015


Author: imranh
Date: 2015-02-02 10:32:09 +0000 (Mon, 02 Feb 2015)
New Revision: 643

Modified:
   branches/sucs-site/lib/ldap-auth.php
Log:
Extend ldap script to let people sign in with their emails because for some people they think username == email adderess

Modified: branches/sucs-site/lib/ldap-auth.php
===================================================================
--- branches/sucs-site/lib/ldap-auth.php	2015-01-30 21:09:38 UTC (rev 642)
+++ branches/sucs-site/lib/ldap-auth.php	2015-02-02 10:32:09 UTC (rev 643)
@@ -33,6 +33,13 @@
 
 	if ($username != "" && $password != ""){
 
+		// 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];
+		}
+
 		// ldap servers
 		$sucsLDAPServer = 'silver.sucs.swan.ac.uk';
 		$lisLDAPServer = 'ccs-suld1.swan.ac.uk';




More information about the Devel mailing list