Lucterios2 / django_auth_ldap3_ad

Simple LDAP/AD auth module for django
https://pypi.python.org/pypi/django-auth-ldap3-ad
GNU General Public License v3.0
45 stars 25 forks source link

Use `string.format` to insert username in ldap query #11

Closed weissglut-dev closed 7 years ago

weissglut-dev commented 7 years ago

Hi Lucterios2,

I had the need to login against an active directory with using either sAMAccountName or userPrincipalName. To have the username inserted twice into the LDAP-query I replaced the % operator with string.format. This breaks the configuration as it is now. So I updated to README.md as well.

I don't know how you are dealing with versions so I put a

from version xxx on you should user (sAMAccountName={0}) ...

to the part in README.

Additionally I changed the userlookup to use the mapped field from LDAP_ATTRIBUTES_MAP to find the correct user.

I hope you like this pull request.

Best Regards Seyhbold

weissglut-dev commented 7 years ago

Hi,

I have changed my branch to use a string.replace('%s', '{0}') before using format. Additionally I changed the README.md

Do you think this is better?

Regards Seyhbold

weissglut-dev commented 7 years ago

Hi,

I'm not sure how you want the PR. I force pushed to the existing one. Or do you want me to create a new PR?

Best Regards Seyhbold

povtux commented 7 years ago

Thanks for your job :)

weissglut-dev commented 7 years ago

Hi,

is there any chance to get this published to pypi?

Thank you very much Regards Seyhbold