diff options
author | 2013-09-12 15:32:20 +0200 | |
---|---|---|
committer | 2013-09-12 15:41:43 +0200 | |
commit | 798345424e1c852b0d37e06a5a2de3f9c3b5816f (patch) | |
tree | 2a210c9db88cc1e7f278bb899a1fdbb73c43a987 /okupy | |
parent | Tests: check whether failed get_bound_ldapuser() doesn't pollute the db. (diff) | |
download | identity.gentoo.org-798345424e1c852b0d37e06a5a2de3f9c3b5816f.tar.gz identity.gentoo.org-798345424e1c852b0d37e06a5a2de3f9c3b5816f.tar.bz2 identity.gentoo.org-798345424e1c852b0d37e06a5a2de3f9c3b5816f.zip |
Clean up settings.DATABASES when get_bound_ldapuser() fails.
For example, if invalid credentials are provided.
Diffstat (limited to 'okupy')
-rw-r--r-- | okupy/common/ldap_helpers.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/okupy/common/ldap_helpers.py b/okupy/common/ldap_helpers.py index 5b3e76a..43f3e3e 100644 --- a/okupy/common/ldap_helpers.py +++ b/okupy/common/ldap_helpers.py @@ -29,7 +29,11 @@ def get_bound_ldapuser(request, password=None): username=username, password=password, ) - return bound_cls.objects.get(username=username) + try: + return bound_cls.objects.get(username=username) + except Exception as e: + bound_cls.restore_alias() + raise e def set_secondary_password(request, password): |