From 4065952f705e8dba2faf368e55a29162c7975b96 Mon Sep 17 00:00:00 2001 From: ante Date: Sat, 3 Jan 2015 15:05:40 +0100 Subject: [PATCH] Making SocialLoginSerializerPasswordChangeSerializer compatible with DRF3 - validate_access_token - works with field value and not with dictionary of all values --- rest_auth/registration/serializers.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/rest_auth/registration/serializers.py b/rest_auth/registration/serializers.py index 7a403a0..5cfe049 100644 --- a/rest_auth/registration/serializers.py +++ b/rest_auth/registration/serializers.py @@ -7,8 +7,7 @@ class SocialLoginSerializer(serializers.Serializer): access_token = serializers.CharField(required=True) - def validate_access_token(self, attrs, source): - access_token = attrs[source] + def validate_access_token(self, value): view = self.context.get('view') request = self.context.get('request') @@ -23,12 +22,12 @@ class SocialLoginSerializer(serializers.Serializer): self.adapter = self.adapter_class() app = self.adapter.get_provider().get_app(request) - token = self.adapter.parse_token({'access_token': access_token}) + token = self.adapter.parse_token({'access_token': value}) token.app = app try: login = self.adapter.complete_login(request, app, token, - response=access_token) + response=value) token.account = login.account login.token = token complete_social_login(request, login) @@ -40,4 +39,4 @@ class SocialLoginSerializer(serializers.Serializer): login.save(request, connect=True) self.object = {'user': login.account.user} - return attrs + return value