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 (