mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-23 15:54:16 +03:00
Minor authentication message improvement.
This commit is contained in:
parent
d015534d53
commit
8b4ce5c636
1
env/pip-selfcheck.json
vendored
Normal file
1
env/pip-selfcheck.json
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"last_check":"2015-02-04T09:06:02Z","pypi_version":"6.0.7"}
|
|
@ -86,8 +86,13 @@ class BasicAuthentication(BaseAuthentication):
|
||||||
Authenticate the userid and password against username and password.
|
Authenticate the userid and password against username and password.
|
||||||
"""
|
"""
|
||||||
user = authenticate(username=userid, password=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.'))
|
raise exceptions.AuthenticationFailed(_('Invalid username/password.'))
|
||||||
|
|
||||||
|
if not user.is_active:
|
||||||
|
raise exceptions.AuthenticationFailed(_('User inactive or deleted.'))
|
||||||
|
|
||||||
return (user, None)
|
return (user, None)
|
||||||
|
|
||||||
def authenticate_header(self, request):
|
def authenticate_header(self, request):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user