Return login data from SocialLoginSerializer.validate for views to use

This commit is contained in:
Luke Burden 2019-08-21 12:59:50 -07:00
parent 624ad01afb
commit f51ebbeffd

View File

@ -142,6 +142,10 @@ class SocialLoginSerializer(serializers.Serializer):
login.lookup() login.lookup()
login.save(request, connect=True) login.save(request, connect=True)
# we return the login data (and so User and SocialAccount instances) here
# such that custom login and connect views can render suitable responses
attrs['login'] = login
# we still return `user` here for backwards compatibility
attrs['user'] = login.account.user attrs['user'] = login.account.user
return attrs return attrs