Update authentication.py

According to:
https://github.com/tomchristie/django-rest-framework/issues/2510#issuecomment-72689550
This commit is contained in:
MEmmanuel 2015-02-03 18:51:00 +01:00
parent 33cfc2e486
commit 186878e112

View File

@ -90,8 +90,10 @@ class BasicAuthentication(BaseAuthentication):
Authenticate the userid and password against username and password.
"""
user = authenticate(username=userid, password=password)
if user is None or not user.is_active:
if user is None:
raise exceptions.AuthenticationFailed('Invalid username/password')
elif not user.is_active:
raise exceptions.AuthenticationFailed('User account is disabled')
return (user, None)
def authenticate_header(self, request):