mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2024-11-22 00:56:34 +03:00
Allow dynamic callback_url and client_class class attributes
This commit is contained in:
parent
95fafe5e0f
commit
d7532b875e
|
@ -83,8 +83,8 @@ class SocialLoginSerializer(serializers.Serializer):
|
|||
|
||||
# Case 2: We received the authorization code
|
||||
elif attrs.get('code'):
|
||||
self.callback_url = getattr(view, 'callback_url', None)
|
||||
self.client_class = getattr(view, 'client_class', None)
|
||||
self.callback_url = view.get_callback_url()
|
||||
self.client_class = view.get_client_class()
|
||||
|
||||
if not self.callback_url:
|
||||
raise serializers.ValidationError(
|
||||
|
|
|
@ -123,6 +123,12 @@ class SocialLoginView(LoginView):
|
|||
"""
|
||||
serializer_class = SocialLoginSerializer
|
||||
|
||||
def get_callback_url(self):
|
||||
return getattr(self, 'callback_url', None)
|
||||
|
||||
def get_client_class(self):
|
||||
return getattr(self, 'client_class', None)
|
||||
|
||||
def process_login(self):
|
||||
get_adapter(self.request).login(self.request, self.user)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user