aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/authentication.py
diff options
context:
space:
mode:
authorJosé Padilla2015-02-04 23:34:20 -0400
committerJosé Padilla2015-02-04 23:34:20 -0400
commit720d154c832794e42e23c3ba2fe7b835d4baf386 (patch)
tree565ba041aa657c76b33aed5f829c8164e8922da9 /rest_framework/authentication.py
parent48fa77c09e2198c7877a724a46230caedcc7b529 (diff)
parentf98f842827c6e79bbaa196482e3c3c549e8999c8 (diff)
downloaddjango-rest-framework-720d154c832794e42e23c3ba2fe7b835d4baf386.tar.bz2
Merge remote-tracking branch 'upstream/version-3.1' into version-3.1
Diffstat (limited to 'rest_framework/authentication.py')
-rw-r--r--rest_framework/authentication.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/rest_framework/authentication.py b/rest_framework/authentication.py
index 11db0585..a75cd30c 100644
--- a/rest_framework/authentication.py
+++ b/rest_framework/authentication.py
@@ -86,8 +86,13 @@ 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.'))
+
+ if not user.is_active:
+ raise exceptions.AuthenticationFailed(_('User inactive or deleted.'))
+
return (user, None)
def authenticate_header(self, request):