mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-07 13:54:47 +03:00
Add note about 'User account is disabled.' vs 'Unable to log in'
This commit is contained in:
parent
f455c67170
commit
b689a3bdaa
|
@ -16,6 +16,9 @@ class AuthTokenSerializer(serializers.Serializer):
|
|||
user = authenticate(username=username, password=password)
|
||||
|
||||
if user:
|
||||
# From Django 1.10 onwards the `authenticate` call simply
|
||||
# returns `None` for is_active=False users.
|
||||
# (Assuming the default `ModelBackend` authentication backend.)
|
||||
if not user.is_active:
|
||||
msg = _('User account is disabled.')
|
||||
raise serializers.ValidationError(msg)
|
||||
|
|
Loading…
Reference in New Issue
Block a user