Add note about 'User account is disabled.' vs 'Unable to log in'

This commit is contained in:
Tom Christie 2016-09-29 12:03:14 +01:00
parent f455c67170
commit b689a3bdaa

View File

@ -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)