diff options
author | 2013-09-22 11:29:56 +0200 | |
---|---|---|
committer | 2013-09-22 11:30:25 +0200 | |
commit | 63a9b74d939b73bf7a170bc8e41cb9bdad790893 (patch) | |
tree | 259469ae14314c3e8a8502e6efd640048ebf3272 | |
parent | Clean up django_auth_ldap leftovers. (diff) | |
download | identity.gentoo.org-63a9b74d939b73bf7a170bc8e41cb9bdad790893.tar.gz identity.gentoo.org-63a9b74d939b73bf7a170bc8e41cb9bdad790893.tar.bz2 identity.gentoo.org-63a9b74d939b73bf7a170bc8e41cb9bdad790893.zip |
Normalize usernames for LDAP.
This decreases the database pollution, and increases compatibility with
mockldap.
-rw-r--r-- | okupy/common/auth.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/okupy/common/auth.py b/okupy/common/auth.py index 08d2fe6..9dcf554 100644 --- a/okupy/common/auth.py +++ b/okupy/common/auth.py @@ -23,6 +23,11 @@ class LDAPAuthBackend(ModelBackend): """ def authenticate(self, request, username, password): + # LDAP is case- and whitespace-insensitive + # we do normalization to avoid duplicate django db entries + # and help mockldap + username = username.lower().strip() + try: bound_ldapuser = get_bound_ldapuser( request=request, |