From 6f047d4c7fa29f53b902e81b49b8d45eb9149904 Mon Sep 17 00:00:00 2001 From: Sander Hoentjen Date: Mon, 3 Mar 2014 12:19:22 +0100 Subject: [PATCH] add option to not strip everything after the @ Usefull if you use email-adress as login --- config.php | 6 +++++- php/class.passwdmodule.php | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/config.php b/config.php index 2ad5e02..133f679 100644 --- a/config.php +++ b/config.php @@ -10,4 +10,8 @@ define('PLUGIN_PASSWD_LDAP_BASEDN', 'dc=example,dc=com'); /** URI to access LDAP server **/ define('PLUGIN_PASSWD_LDAP_URI', 'localhost'); -?> \ No newline at end of file + +/** Set to true if you login with username@tenantname **/ +define('PLUGIN_PASSWD_LOGIN_WITH_TENANT', false); + +?> diff --git a/php/class.passwdmodule.php b/php/class.passwdmodule.php index 17399f6..f33d18e 100644 --- a/php/class.passwdmodule.php +++ b/php/class.passwdmodule.php @@ -90,8 +90,12 @@ class PasswdModule extends Module // check connection is successfull if(ldap_errno($ldapconn) === 0) { // get the users uid, if we have a multi tenant installation then remove company name from user name - $parts = explode('@', $data['username']); - $uid = $parts[0]; + if (PLUGIN_PASSWD_LOGIN_WITH_TENANT){ + $parts = explode('@', $data['username']); + $uid = $parts[0]; + } else { + $uid = $data['username']; + } // search for the user dn that will be used to do login into LDAP $userdn = ldap_search (