mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-06 13:30:12 +03:00
Merge pull request #1 from MEmmanuel/update_autentication
Update authentication.py
This commit is contained in:
commit
3284410aac
|
@ -90,8 +90,10 @@ 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')
|
||||||
|
elif not user.is_active:
|
||||||
|
raise exceptions.AuthenticationFailed('User account is disabled')
|
||||||
return (user, None)
|
return (user, None)
|
||||||
|
|
||||||
def authenticate_header(self, request):
|
def authenticate_header(self, request):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user