I am writing a custom authentication backend (and a custom user model) to check if a user account is locked or expired. I see that in all the examples of authentication backend return value is either a User object or None. And the only exception generated is User.DoesNotExist.
My question is how should I go about returning different results (e.g. account is locked or expired or max number of login attempts have reached)?
Should I raise custom exceptions or there is another way to do this?
I am using Django 1.5alpha.
EDIT:
I need to get multiple statuses to display appropriate message to a user and redirect to an appropriate view.
I ended up doing this in case anyone has the same question.
Then in the login form you can catch these errors and pass on appropriate validation errors to the view.