Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8ef85758
authored
Feb 10, 2013
by
x
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
store: Fixed new user creation
parent
6841879c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
store/views.py
+8
-8
No files found.
store/views.py
View file @
8ef85758
...
@@ -11,7 +11,7 @@ import os
...
@@ -11,7 +11,7 @@ import os
import
json
import
json
import
base64
import
base64
def
estabilish_store_user
(
user
):
def
estabilish_store_user
(
request
,
user
):
try
:
try
:
details
=
request
.
user
.
userclouddetails_set
.
all
()[
0
]
details
=
request
.
user
.
userclouddetails_set
.
all
()[
0
]
password
=
details
.
smb_password
password
=
details
.
smb_password
...
@@ -22,14 +22,14 @@ def estabilish_store_user(user):
...
@@ -22,14 +22,14 @@ def estabilish_store_user(user):
except
:
except
:
return
HttpResponse
(
'Can not acces to django database!'
,
status_code
=
404
)
return
HttpResponse
(
'Can not acces to django database!'
,
status_code
=
404
)
#Create user
#Create user
if
not
StoreApi
.
createuser
(
user
,
password
,
key_list
,
str
(
quota
)):
if
not
StoreApi
.
createuser
(
user
,
password
,
key_list
,
str
(
quota
)):
return
HttpResponse
(
'User does not exist on store! And could not create!'
)
return
HttpResponse
(
'User does not exist on store! And could not create!'
)
@login_required
@login_required
def
index
(
request
):
def
index
(
request
):
user
=
request
.
user
.
username
user
=
request
.
user
.
username
if
StoreApi
.
userexist
(
user
)
!=
True
:
if
StoreApi
.
userexist
(
user
)
!=
True
:
estabilish_store_user
(
user
)
estabilish_store_user
(
request
,
user
)
#UpdateAuthorizationInfo
#UpdateAuthorizationInfo
try
:
try
:
auth
=
request
.
POST
[
'auth'
]
auth
=
request
.
POST
[
'auth'
]
...
@@ -41,14 +41,14 @@ def index(request):
...
@@ -41,14 +41,14 @@ def index(request):
key_list
.
append
(
key
.
key
)
key_list
.
append
(
key
.
key
)
except
:
except
:
return
HttpResponse
(
'Can not acces to django database!'
,
status_code
=
404
)
return
HttpResponse
(
'Can not acces to django database!'
,
status_code
=
404
)
if
not
StoreApi
.
updateauthorizationinfo
(
user
,
password
,
key_list
):
if
not
StoreApi
.
updateauthorizationinfo
(
user
,
password
,
key_list
):
return
HttpResponse
(
'Can not update authorization information!'
)
return
HttpResponse
(
'Can not update authorization information!'
)
except
:
except
:
pass
pass
#Download handler
#Download handler
try
:
try
:
dl
=
request
.
POST
[
'dl'
]
dl
=
request
.
POST
[
'dl'
]
return
redirect
(
StoreApi
.
requestdownload
(
user
,
dl
))
return
redirect
(
StoreApi
.
requestdownload
(
user
,
dl
))
except
:
except
:
pass
pass
#Upload handler
#Upload handler
...
@@ -87,7 +87,7 @@ def index(request):
...
@@ -87,7 +87,7 @@ def index(request):
def
ajax_listfolder
(
request
):
def
ajax_listfolder
(
request
):
user
=
request
.
user
.
username
user
=
request
.
user
.
username
if
StoreApi
.
userexist
(
user
)
!=
True
:
if
StoreApi
.
userexist
(
user
)
!=
True
:
estabilish_store_user
(
user
)
estabilish_store_user
(
request
,
user
)
path
=
'/'
path
=
'/'
try
:
try
:
path
=
request
.
POST
[
'path'
]
path
=
request
.
POST
[
'path'
]
...
@@ -102,7 +102,7 @@ def ajax_listfolder(request):
...
@@ -102,7 +102,7 @@ def ajax_listfolder(request):
def
ajax_quota
(
request
):
def
ajax_quota
(
request
):
user
=
request
.
user
.
username
user
=
request
.
user
.
username
if
StoreApi
.
userexist
(
user
)
!=
True
:
if
StoreApi
.
userexist
(
user
)
!=
True
:
estabilish_store_user
(
user
)
estabilish_store_user
(
request
,
user
)
return
HttpResponse
(
json
.
dumps
(
StoreApi
.
requestquota
(
user
)))
return
HttpResponse
(
json
.
dumps
(
StoreApi
.
requestquota
(
user
)))
#return HttpResponse(json.dumps({'Used':20,'Soft':160,'Hard':200}))
#return HttpResponse(json.dumps({'Used':20,'Soft':160,'Hard':200}))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment