title: Custom Django AuthenticationForm with validation depending on prior error messages
body: <p>I am extending Django's AuthenticationForm in order to provide better error messaging to the user.  If login is going to fail, I want to perform an additional check on the user's input to provide a less generic message explaining to the user why login failed.</p>
  
  <p>urls:py:</p>
  
  <pre><code>urlpatterns = patterns(
     'django.contrib.auth.views',
      url(r'^login/$', 'login', {'authentication_form': RemoteLoginAwareLoginForm}, name='auth_login'),
  )
  </code></pre>
  
  <p>forms.py:</p>
  
  <pre><code>class RemoteLoginAwareLoginForm(AuthenticationForm):
      def clean(self):
        cleaned_data = super(AuthenticationForm, self).clean()
        if self.errors:  # &lt;==== self.errors is {}, even when login will fail
            # Perform additional checks
        return cleaned_data
  </code></pre>
  
  <p>I thought that the right way to do this was to override clean() as above, but as indicated, self.errors is empty even when I logged in with bad credentials.  I tried to override full_clean() and validate() as well, but neither got called at all.</p>
  
  <p>Update:</p>
  
  <p>I realize that the error I'm looking for -- that the credentials aren't valid -- doesn't come until the code actually attempts to log the user in.  I added a custom ModelBackend where I am able to catch the error...  but I am not sure how to report it back up as there is no request here.</p>
  
  <p>Is the answer that this requires a custom login view?</p>
  
  <p>Thanks!</p>