diff options
author | 2013-09-12 15:48:11 +0200 | |
---|---|---|
committer | 2013-09-22 11:03:21 +0200 | |
commit | 7d11dca14fb171b33fbaa425cedbb55c746545ab (patch) | |
tree | c2848dacf05f97ed8583e041f63407c74a60fc2e | |
parent | Merge pull request #99 from dastergon/minor_fixes (diff) | |
download | identity.gentoo.org-7d11dca14fb171b33fbaa425cedbb55c746545ab.tar.gz identity.gentoo.org-7d11dca14fb171b33fbaa425cedbb55c746545ab.tar.bz2 identity.gentoo.org-7d11dca14fb171b33fbaa425cedbb55c746545ab.zip |
get_bound_ldapuser(): support custom username.
-rw-r--r-- | okupy/common/ldap_helpers.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/okupy/common/ldap_helpers.py b/okupy/common/ldap_helpers.py index 43f3e3e..69cacbf 100644 --- a/okupy/common/ldap_helpers.py +++ b/okupy/common/ldap_helpers.py @@ -9,13 +9,14 @@ from okupy.accounts.models import LDAPUser from okupy.crypto.ciphers import cipher -def get_bound_ldapuser(request, password=None): +def get_bound_ldapuser(request, password=None, username=None): """ Get LDAPUser with connection bound to the current user. Uses either provided password or the secondary password saved in session. """ - username = request.user.username + if not username: + username = request.user.username if not password: try: password = b64encode(cipher.decrypt( |