From 4a3d715321602253e58fd5b7f5422792f68f3b18 Mon Sep 17 00:00:00 2001 From: Sander Hoentjen Date: Mon, 3 Mar 2014 12:18:53 +0100 Subject: [PATCH 1/2] fix typo --- php/class.passwdmodule.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/php/class.passwdmodule.php b/php/class.passwdmodule.php index e11e638..17399f6 100644 --- a/php/class.passwdmodule.php +++ b/php/class.passwdmodule.php @@ -109,7 +109,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 +245,4 @@ class PasswdModule extends Module return $hash; } } -?> \ No newline at end of file +?> From 6f047d4c7fa29f53b902e81b49b8d45eb9149904 Mon Sep 17 00:00:00 2001 From: Sander Hoentjen Date: Mon, 3 Mar 2014 12:19:22 +0100 Subject: [PATCH 2/2] 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 (