Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using mail as login uid #7

Open
mxwendler opened this issue Feb 8, 2019 · 0 comments
Open

Using mail as login uid #7

mxwendler opened this issue Feb 8, 2019 · 0 comments

Comments

@mxwendler
Copy link

mxwendler commented Feb 8, 2019

We have very long email adresses, yet we use them as login names. When using mail adresses as uid, they are too long to fit into the php list user table row with 25 chars limited. So we switch to the ldap uid silently after login succeeeds.

Patch included. Works correctly so far, not extensively tested.

diff --git a/phplist-3.3.4/public_html/lists/admin/plugins/ldapAuth.php b/phplist-3.3.4/public_html/lists/admin/plugins/ldapAuth.php
index 8e48dd8..066f5f3 100644
--- a/phplist-3.3.4/public_html/lists/admin/plugins/ldapAuth.php
+++ b/phplist-3.3.4/public_html/lists/admin/plugins/ldapAuth.php
@@ -173,6 +173,14 @@ class ldapAuth extends phplistPlugin {
       // check to see if it worked
       if (strval(strtolower($myResult[0])) == $login) {
 
+
+        // When using mail as login, it may be too long for database field.
+        // from here on we continue with uid ( max.mueller@mail.com => mmueller )
+        $login = $myResult[2]['uid'][0];
+	//echo "\nldap:" . $login . "\n";
+	//var_dump($myResult[2]);
+	//return array(0, 'hw error');
+
         // see if there is an existing record
         $admindata = Sql_Fetch_Array_Query(sprintf('select password,disabled,id from %s where loginname = "%s"',$GLOBALS["tables"]["admin"],addslashes($login)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant