Archived
Password check in sane place.
This commit is contained in:
1 parent
2bdaf32e87
commit
63243efd4c
2 files changed
+9
-5
No files matched your search
@@ -1,4 +1,6 @@
|
||||
from django.contrib.auth.forms import SetPasswordForm
|
||||
from django.core.validators import MinLengthValidator
|
||||
from validators import PasswordValidator
|
||||
|
||||
from models import *
|
||||
|
||||
@@ -13,6 +15,13 @@ class LDAPSetPasswordForm(SetPasswordForm):
|
||||
self.user.save()
|
||||
return self.user
|
||||
|
||||
def clean_new_password1(self):
|
||||
raw_password = self.cleaned_data.get('new_password1')
|
||||
# Validation here?
|
||||
MinLengthValidator(8)(raw_password)
|
||||
PasswordValidator(raw_passwords)
|
||||
return raw_password
|
||||
|
||||
class LDAPPasswordChangeForm(LDAPSetPasswordForm):
|
||||
pass
|
||||
#old_password = forms.CharField(label=_("Old password"), widget=forms.PasswordInput)
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
from ldapdb.models.fields import CharField, ImageField, IntegerField, ListField
|
||||
import ldapdb.models
|
||||
import passwd
|
||||
from django.core.validators import MinLengthValidator
|
||||
from validators import PasswordValidator
|
||||
class LdapUser(ldapdb.models.Model):
|
||||
"""
|
||||
Class for representing an LDAP user entry.
|
||||
@@ -33,9 +31,6 @@ class LdapUser(ldapdb.models.Model):
|
||||
if raw_password is None:
|
||||
self.password = "!"
|
||||
else:
|
||||
# Validation here?
|
||||
MinLengthValidator(8)(raw_password)
|
||||
PasswordValidator(raw_password)
|
||||
self.password = passwd.ldap_create(raw_password)
|
||||
self.save()
|
||||
|
||||
|
||||
Reference in new issue
Block a user