I've written a custom backend for Django auth to hook into our Active
Directory. It works great, but some users can't seem to figure out
that "username" does not equal "email address". Since our AD is kind
of borked, multiple users *might* have the same email addresses, so
simply changing it to also allow auth based on email won't work.

We had the idea that, if we checked for the presence of an "@" sign in
the code, we could raise a validation error in our backend, and it
would be a nice "user education" opportunity.


Inside my authenticate() method, I have:
if "@" in username:
 raise ValidationError("Hey idiot")

In the template, when I access {{ form.errors }} it shows up, but it
is wrapped very strangely. Likewise when I try to loop through it.

How can I get *just* the text of the error? I tried looping over
form.errors.itervalues, but that still returns html.

I could *settle* for the extra html, but we're using the same backend
for the admin, and my ValidationError is not trapped by its login
view, so I end up with a 500.

Thanks!


AD Backend:
http://dpaste.com/237935/

Template Examples:
http://dpaste.com/237938/


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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