operasoftware / dns-ui

Opera's LDAP-authenticated PowerDNS user interface
Apache License 2.0
282 stars 57 forks source link

Fix login issue for LDAP users without email address #178

Open ma-evans opened 3 years ago

ma-evans commented 3 years ago

This PR fixes an issue where LDAP users without an email address wouldn't be populated in the dns-ui user list on login.

The user is able to log in but prompted with "something went wrong", which turned out to be caused by missing email field in $ldapuser (e.g. $ldapuser['mail']). Checking the field exists resolves the error, and setting the email address to an empty string in this case seems as sensible as anything else.

This was seen using Active Directory LDAP server, which in our case only returns the field for users with an email address assigned.

ma-evans commented 3 years ago

Updated the issue description to better reflect the changes (issue was missing field in $ldapuser, not $config).