> I'm using the built-in password_change view. Is there an easy way to
> specify a minimum password length for the new password? (Other than
> using javascript in the template)

Well, you probably want your server-side to match whatever validation
on the client-side and you want it to work without js.  I don't know
if this is the *best way to do it but you could modify some of the
clean methods in django/contrib/auth/forms.py and return an error if
it is not above the certain length.  I was also told that a regex
might work.

    def clean_password2(self):
        password1 = self.cleaned_data.get("password1", "")
        password2 = self.cleaned_data["password2"]
        if password1 != password2:
            raise forms.ValidationError(_("The two password fields
didn't match."))
        if len(password1) < YourMinValueAsInt:
            raise form.ValidationError(_("Password not long enough"))
        return password2

If you don't want to change it for all apps using this django install
you could move auth into your project dir and have "auth" in your
installed apps instead of django.contrib.auth.  Maybe someone has a
better solution but there doesn't appear to be a simple setting for
this.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to