title: Enforcing a min length in Django password
body: <p>I am currently using <code>django.contrib.auth.views.password_password_reset_confirm</code> to change a user's password. This is how my urls look:</p>
  
  <pre><code>from django.contrib.auth import views as auth_views
  
  url(r'^password/reset/confirm/(?P&lt;uidb36&gt;[0-9A-Za-z]+)-(?P&lt;token&gt;.+)/$',
      redirect_if_loggedin(auth_views.password_reset_confirm),
      name='auth_password_reset_confirm'),
  </code></pre>
  
  <p>Currently, I am doing it directly into the django trunk -</p>
  
  <pre><code># django.contrib.auth.views
  def clean_new_password2(self):
      password1 = self.cleaned_data.get('new_password1')
      password2 = self.cleaned_data.get('new_password2')
      if password1 and password2:
          if len(password1) &lt; 8:
              raise forms.ValidationError(_("Password must be at least 8 chars."))
          if password1 != password2:
              raise forms.ValidationError(_("The two password fields didn't match."))
      return password2
  </code></pre>
  
  <p>Surely there must be a better way.</p>