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 e11e638..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 ( @@ -109,7 +113,7 @@ class PasswdModule extends Module ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3); // login with current password if that fails then current password is wrong - $bind = ldap_bind($ladpconn, $userdn, $data['current_password']); + $bind = ldap_bind($ldapconn, $userdn, $data['current_password']); if(ldap_errno($ldapconn) === 0) { $passwd = $data['new_password']; @@ -245,4 +249,4 @@ class PasswdModule extends Module return $hash; } } -?> \ No newline at end of file +?>