mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-01 19:10:12 +03:00
Removed unused code.
This commit is contained in:
parent
28040b3bda
commit
d1d1abb377
|
@ -16,19 +16,17 @@ class AuthTokenSerializer(serializers.Serializer):
|
||||||
username = attrs.get('username')
|
username = attrs.get('username')
|
||||||
password = attrs.get('password')
|
password = attrs.get('password')
|
||||||
|
|
||||||
if username and password:
|
|
||||||
user = authenticate(request=self.context.get('request'),
|
|
||||||
username=username, password=password)
|
|
||||||
|
|
||||||
# The authenticate call simply returns None for is_active=False
|
user = authenticate(request=self.context.get('request'),
|
||||||
# users. (Assuming the default ModelBackend authentication
|
username=username, password=password)
|
||||||
# backend.)
|
|
||||||
if not user:
|
# The authenticate call simply returns None for is_active=False
|
||||||
msg = _('Unable to log in with provided credentials.')
|
# users. (Assuming the default ModelBackend authentication
|
||||||
raise serializers.ValidationError(msg, code='authorization')
|
# backend.)
|
||||||
else:
|
if not user:
|
||||||
msg = _('Must include "username" and "password".')
|
msg = _('Unable to log in with provided credentials.')
|
||||||
raise serializers.ValidationError(msg, code='authorization')
|
raise serializers.ValidationError(msg, code='authorization')
|
||||||
|
|
||||||
|
|
||||||
attrs['user'] = user
|
attrs['user'] = user
|
||||||
return attrs
|
return attrs
|
||||||
|
|
Loading…
Reference in New Issue
Block a user