diff options
author | 2013-09-23 04:09:19 -0700 | |
---|---|---|
committer | 2013-09-23 04:09:19 -0700 | |
commit | b436f2fc91ab77845c1ad3e2586317d1262e4099 (patch) | |
tree | e8b73888829cf19906dad0417f349719fd01942a | |
parent | Merge pull request #92 from mgorny/no-django_ldap_auth (diff) | |
parent | fix pep8 errors (diff) | |
download | identity.gentoo.org-b436f2fc91ab77845c1ad3e2586317d1262e4099.tar.gz identity.gentoo.org-b436f2fc91ab77845c1ad3e2586317d1262e4099.tar.bz2 identity.gentoo.org-b436f2fc91ab77845c1ad3e2586317d1262e4099.zip |
Merge pull request #101 from dastergon/final_fixes
Misc final fixes
-rw-r--r-- | MANIFEST.in | 2 | ||||
-rw-r--r-- | okupy/accounts/views.py | 15 | ||||
-rw-r--r-- | okupy/common/fields.py | 4 | ||||
-rw-r--r-- | okupy/common/ldap_helpers.py | 6 | ||||
-rw-r--r-- | okupy/settings/__init__.py | 4 | ||||
-rw-r--r-- | okupy/templates/settings-profile.html | 4 | ||||
-rw-r--r-- | okupy/tests/settings.py | 4 |
7 files changed, 26 insertions, 13 deletions
diff --git a/MANIFEST.in b/MANIFEST.in index f714e67..ac2f52c 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,7 +4,7 @@ recursive-include okupy/templates * recursive-include okupy/tests/fixtures *.json include manage.py include LICENSE -include README.md +include README.rst include docs/source/Makefile include okupy/settings/local.py.sample include okupy/settings/development.py.sample diff --git a/okupy/accounts/views.py b/okupy/accounts/views.py index 36980ee..febe39b 100644 --- a/okupy/accounts/views.py +++ b/okupy/accounts/views.py @@ -431,10 +431,12 @@ def password_settings(request): password_settings = PasswordSettingsForm(request.POST) if password_settings.is_valid(): try: - new_password = password_settings.cleaned_data['new_password'] + new_password = password_settings.cleaned_data[ + 'new_password'] new_password_verify = password_settings.cleaned_data[ 'new_password_verify'] - old_password = password_settings.cleaned_data['old_password'] + old_password = password_settings.cleaned_data[ + 'old_password'] if old_password and (new_password == new_password_verify): for hash in list(user_info.password): @@ -576,11 +578,14 @@ def gentoo_dev_settings(request): gentoo_account_settings = GentooAccountSettingsForm(request.POST) if gentoo_account_settings.is_valid(): try: - devbug = gentoo_account_settings.cleaned_data['developer_bug'] + devbug = gentoo_account_settings.cleaned_data[ + 'developer_bug'] gentoo_join_date = gentoo_account_settings.cleaned_data[ 'gentoo_join_date'] - gentoo_mentor = gentoo_account_settings.cleaned_data['mentor'] - ssh_pubkey = gentoo_account_settings.cleaned_data['ssh_key'] + gentoo_mentor = gentoo_account_settings.cleaned_data[ + 'mentor'] + ssh_pubkey = gentoo_account_settings.cleaned_data[ + 'ssh_key'] if user_info.developer_bug != devbug: user_info.developer_bug.append(devbug) diff --git a/okupy/common/fields.py b/okupy/common/fields.py index 86754f0..c19dedc 100644 --- a/okupy/common/fields.py +++ b/okupy/common/fields.py @@ -4,6 +4,7 @@ from django.db.models import fields from ldapdb import escape_ldap_filter + class ACLField(fields.Field): def _group(self): return self.name.split('_')[1] + '.group' @@ -14,7 +15,8 @@ class ACLField(fields.Field): else: return False - def get_db_prep_lookup(self, lookup_type, value, connection, prepared=False): + def get_db_prep_lookup(self, lookup_type, value, + connection, prepared=False): "Returns field's value prepared for database lookup." return [self.get_prep_lookup(lookup_type, value)] diff --git a/okupy/common/ldap_helpers.py b/okupy/common/ldap_helpers.py index c8ac5dd..2a5250f 100644 --- a/okupy/common/ldap_helpers.py +++ b/okupy/common/ldap_helpers.py @@ -44,7 +44,8 @@ def set_secondary_password(request, password): """ Generate a secondary passsword and encrypt it in the session """ with get_bound_ldapuser(request, password) as user: secondary_password = Random.get_random_bytes(48) - request.session['secondary_password'] = cipher.encrypt(secondary_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 list(user.password): @@ -55,7 +56,8 @@ def set_secondary_password(request, password): # don't remove unknown hashes pass # Add a new generated encrypted password to LDAP - user.password.append(ldap_md5_crypt.encrypt(b64encode(secondary_password))) + user.password.append( + ldap_md5_crypt.encrypt(b64encode(secondary_password))) user.save() diff --git a/okupy/settings/__init__.py b/okupy/settings/__init__.py index 76f5ba1..7e0c4f0 100644 --- a/okupy/settings/__init__.py +++ b/okupy/settings/__init__.py @@ -140,6 +140,10 @@ LOGGING = { 'handlers': ['console' if DEBUG else 'syslog'], 'level': 'DEBUG' if DEBUG else 'INFO', }, + 'ldapdb': { + 'handlers': ['console' if DEBUG else 'syslog'], + 'level': 'DEBUG' if DEBUG else 'INFO', + }, 'paramiko': { 'handlers': ['console' if DEBUG else 'syslog'], 'level': 'DEBUG' if DEBUG else 'INFO', diff --git a/okupy/templates/settings-profile.html b/okupy/templates/settings-profile.html index 66a6936..715e184 100644 --- a/okupy/templates/settings-profile.html +++ b/okupy/templates/settings-profile.html @@ -19,10 +19,6 @@ {{ profile_settings.last_name.label_tag }} <input name="last_name" type="text" value="{{ user_info.last_name }}" /> {{ profile_settings.last_name.errors|striptags }} </div> - <div class="row-fluid"> - {{ profile_settings.email.label_tag }} - <input name="email" type="text" value="{{ user_info.email.0 }}" /> {{ profile_settings.email.errors|striptags }} - </div> <!-- <div class="row-fluid"> {{ profile_settings.birthday.label_tag }} <input name="birthday" type="text" value="{{ user_info.birthday }}" /> {{ profile_settings.birthday.errors|striptags }} diff --git a/okupy/tests/settings.py b/okupy/tests/settings.py index deb2f15..57b184f 100644 --- a/okupy/tests/settings.py +++ b/okupy/tests/settings.py @@ -259,6 +259,10 @@ LOGGING = { 'handlers': ['console' if DEBUG else 'null'], 'level': 'DEBUG' if DEBUG else 'INFO', }, + 'ldapdb': { + 'handlers': ['console' if DEBUG else 'null'], + 'level': 'DEBUG' if DEBUG else 'INFO', + } } } |