Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-CloudComputing
/
C_Team_KhuDrive
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
김재형
2020-06-14 18:29:25 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
763903f64c6723caea6ce824a9cbe483247bddf4
763903f6
1 parent
6b637812
Set root folder on register and return user data on login
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
backend/api/views.py
backend/requirements.txt
backend/api/views.py
View file @
763903f
...
...
@@ -46,6 +46,8 @@ class UserViewSet(viewsets.ModelViewSet):
root
=
Item
(
is_folder
=
True
,
name
=
"root"
,
file_type
=
"folder"
,
path
=
""
,
user_id
=
user
.
int_id
,
size
=
0
,
status
=
True
)
root
.
save
()
user
.
root_folder
=
root
.
item_id
user
.
save
()
return
Response
({
'message'
:
'user created'
,
'int_id'
:
user
.
int_id
,
...
...
@@ -89,7 +91,15 @@ class UserViewSet(viewsets.ModelViewSet):
exp
=
jwt
.
decode
(
access
,
settings
.
SECRET_KEY
,
algorithm
=
'HS256'
)[
'exp'
]
token
=
{
'access'
:
access
,
'refresh'
:
refresh
,
'exp'
:
exp
}
'exp'
:
exp
,
'user'
:
{
'int_id'
:
user
.
int_id
,
'user_id'
:
user
.
user_id
,
'name'
:
user
.
name
,
'total_size'
:
user
.
total_size
,
'current_size'
:
user
.
current_size
,
'root_folder'
:
user
.
root_folder
}}
return
JsonResponse
(
token
,
status
=
status
.
HTTP_200_OK
,
...
...
backend/requirements.txt
View file @
763903f
...
...
@@ -8,9 +8,9 @@ django-annoying==0.10.6
djangorestframework==3.11.0
docutils==0.15.2
jmespath==0.10.0
jwt==1.0.0
psycopg2==2.8.5
pycparser==2.20
PyJWT==1.7.1
python-dateutil==2.8.1
pytz==2020.1
s3transfer==0.3.3
...
...
Please
register
or
login
to post a comment