I'm using Django's builtin AuthenticationForm
Here's my login view: http://dpaste.com/18110/
Form submittal (not empty or empty fields) takes me back to the login
page with 'Did not login'. My debugging print statement isn't showing
up in the terminal, so is_valid is somehow returning false.
If I submit with empty fields, I don't get the default 'This field is
required' type of error messages that I would expect. I'm not sure
how clean() is working with the AuthenticationForm... Am I validating
correctly? Or is something happening in the authentication process?
Thanks.
# django.contrib.auth.forms.py
# AuthenticationForm's clean()
...
def clean(self):
username = self.cleaned_data.get('username')
password = self.cleaned_data.get('password')
if username and password:
self.user_cache = authenticate(username=username,
password=password)
if self.user_cache is None:
raise forms.ValidationError(_("Please enter a correct
username and password. Note that both fields are case-sensitive."))
elif not self.user_cache.is_active:
raise forms.ValidationError(_("This account is
inactive."))
# TODO: determine whether this should move to its own method.
if self.request:
if not self.request.session.test_cookie_worked():
raise forms.ValidationError(_("Your Web browser
doesn't appear to have cookies enabled. Cookies are required for
logging in."))
return self.cleaned_data
...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---