Showing
2 changed files
with
12 additions
and
2 deletions
... | @@ -46,6 +46,8 @@ class UserViewSet(viewsets.ModelViewSet): | ... | @@ -46,6 +46,8 @@ class UserViewSet(viewsets.ModelViewSet): |
46 | root = Item(is_folder=True, name="root", file_type="folder", path="", user_id=user.int_id, size=0, | 46 | root = Item(is_folder=True, name="root", file_type="folder", path="", user_id=user.int_id, size=0, |
47 | status=True) | 47 | status=True) |
48 | root.save() | 48 | root.save() |
49 | + user.root_folder = root.item_id | ||
50 | + user.save() | ||
49 | return Response({ | 51 | return Response({ |
50 | 'message': 'user created', | 52 | 'message': 'user created', |
51 | 'int_id': user.int_id, | 53 | 'int_id': user.int_id, |
... | @@ -89,7 +91,15 @@ class UserViewSet(viewsets.ModelViewSet): | ... | @@ -89,7 +91,15 @@ class UserViewSet(viewsets.ModelViewSet): |
89 | exp = jwt.decode(access, settings.SECRET_KEY, algorithm='HS256')['exp'] | 91 | exp = jwt.decode(access, settings.SECRET_KEY, algorithm='HS256')['exp'] |
90 | token = {'access': access, | 92 | token = {'access': access, |
91 | 'refresh': refresh, | 93 | 'refresh': refresh, |
92 | - 'exp': exp} | 94 | + 'exp': exp, |
95 | + 'user': { | ||
96 | + 'int_id': user.int_id, | ||
97 | + 'user_id': user.user_id, | ||
98 | + 'name': user.name, | ||
99 | + 'total_size': user.total_size, | ||
100 | + 'current_size': user.current_size, | ||
101 | + 'root_folder': user.root_folder | ||
102 | + }} | ||
93 | return JsonResponse( | 103 | return JsonResponse( |
94 | token, | 104 | token, |
95 | status=status.HTTP_200_OK, | 105 | status=status.HTTP_200_OK, | ... | ... |
... | @@ -8,9 +8,9 @@ django-annoying==0.10.6 | ... | @@ -8,9 +8,9 @@ django-annoying==0.10.6 |
8 | djangorestframework==3.11.0 | 8 | djangorestframework==3.11.0 |
9 | docutils==0.15.2 | 9 | docutils==0.15.2 |
10 | jmespath==0.10.0 | 10 | jmespath==0.10.0 |
11 | -jwt==1.0.0 | ||
12 | psycopg2==2.8.5 | 11 | psycopg2==2.8.5 |
13 | pycparser==2.20 | 12 | pycparser==2.20 |
13 | +PyJWT==1.7.1 | ||
14 | python-dateutil==2.8.1 | 14 | python-dateutil==2.8.1 |
15 | pytz==2020.1 | 15 | pytz==2020.1 |
16 | s3transfer==0.3.3 | 16 | s3transfer==0.3.3 | ... | ... |
-
Please register or login to post a comment