aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Chatzimichos <tampakrap@gentoo.org>2013-08-18 12:21:08 +0200
committerTheo Chatzimichos <tampakrap@gentoo.org>2013-08-19 23:16:21 +0200
commitc2c08d01bf1c08eacdff39899b6d7e636e3e03ee (patch)
treee7d67ae63a7748e6582483f016df0927a36c08a1 /okupy/common
parentStop iterating when secondary password is removed (diff)
downloadidentity.gentoo.org-c2c08d01bf1c08eacdff39899b6d7e636e3e03ee.tar.gz
identity.gentoo.org-c2c08d01bf1c08eacdff39899b6d7e636e3e03ee.tar.bz2
identity.gentoo.org-c2c08d01bf1c08eacdff39899b6d7e636e3e03ee.zip
Iterate through all passwords in the list
If there are three items in the list and the second one gets removed, then the third one gets ignored. By iterating to a copy of the original password list we ensure all items are getting iterated.
Diffstat (limited to 'okupy/common')
-rw-r--r--okupy/common/ldap_helpers.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/okupy/common/ldap_helpers.py b/okupy/common/ldap_helpers.py
index c0e932b..1bcfa69 100644
--- a/okupy/common/ldap_helpers.py
+++ b/okupy/common/ldap_helpers.py
@@ -38,7 +38,7 @@ def set_secondary_password(request, password):
request.session['secondary_password'] = cipher.encrypt(secondary_password)
# Clean up possible leftover secondary passwords from the LDAP account
if len(user.password) > 1:
- for hash in user.password:
+ for hash in list(user.password):
try:
if not ldap_md5_crypt.verify(password, hash):
user.password.remove(hash)
@@ -60,7 +60,7 @@ def remove_secondary_password(request):
user = get_bound_ldapuser(request, password)
if len(user.password) > 1:
- for hash in user.password:
+ for hash in list(user.password):
try:
if ldap_md5_crypt.verify(password, hash):
user.password.remove(hash)