mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2024-12-02 13:53:43 +03:00
update registration views to work with simplejwt
This commit is contained in:
parent
4fb746e645
commit
23e88f9838
|
@ -49,7 +49,8 @@ class RegisterView(CreateAPIView):
|
||||||
if getattr(settings, 'REST_USE_JWT', False):
|
if getattr(settings, 'REST_USE_JWT', False):
|
||||||
data = {
|
data = {
|
||||||
'user': user,
|
'user': user,
|
||||||
'token': self.token
|
'access_token': self.access_token,
|
||||||
|
'refresh_token': self.refresh_token
|
||||||
}
|
}
|
||||||
return JWTSerializer(data).data
|
return JWTSerializer(data).data
|
||||||
else:
|
else:
|
||||||
|
@ -68,7 +69,7 @@ class RegisterView(CreateAPIView):
|
||||||
def perform_create(self, serializer):
|
def perform_create(self, serializer):
|
||||||
user = serializer.save(self.request)
|
user = serializer.save(self.request)
|
||||||
if getattr(settings, 'REST_USE_JWT', False):
|
if getattr(settings, 'REST_USE_JWT', False):
|
||||||
self.token = jwt_encode(user)
|
self.access_token, self.refresh_token = jwt_encode(user)
|
||||||
else:
|
else:
|
||||||
create_token(self.token_model, user, serializer)
|
create_token(self.token_model, user, serializer)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user