Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Zheng Yile
codiaclient
Commits
52fd9590
Commit
52fd9590
authored
Jun 28, 2021
by
Zheng Yile
Browse files
Merge branch 'dev' into gui-master
parents
19ab30f9
2361c8e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
codiaclient/cachectrl.py
View file @
52fd9590
...
...
@@ -7,11 +7,18 @@ from .utils import passwd_hash, cookie_encrypt
variables
=
{
'cache_on'
:
True
,
'logindic'
:
{}
'logindic'
:
{},
'tmpPath'
:
""
}
from
os
import
environ
,
path
,
makedirs
variables
[
'tmpPath'
]
=
path
.
join
(
environ
[
'temp'
]
,
'codiaclient'
)
if
not
path
.
exists
(
variables
[
'tmpPath'
]):
makedirs
(
variables
[
'tmpPath'
])
variables
[
'tmpPath'
]
=
path
.
join
(
variables
[
'tmpPath'
],
".cache"
)
def
cache_for_login
(
userdic
,
passwd
,
cookie
=
None
,
passwd_store_on
=
0
,
file
=
'./codiaclient.cache'
):
def
cache_for_login
(
userdic
,
passwd
,
cookie
=
None
,
passwd_store_on
=
0
):
file
=
variables
[
'tmpPath'
]
if
not
variables
[
'cache_on'
]:
report
(
"Invalid reference of function 'cache_username_passwd_cookie'."
,
1
)
return
False
...
...
@@ -49,7 +56,8 @@ def cache_for_login(userdic, passwd, cookie=None, passwd_store_on=0, file='./cod
raise
def
update_cache_for_login
(
username
,
passwd
,
passwd_store_on
=
0
,
file
=
'./codiaclient.cache'
):
def
update_cache_for_login
(
username
,
passwd
,
passwd_store_on
=
0
):
file
=
variables
[
'tmpPath'
]
userdic
=
variables
[
'logindic'
][
username
]
username
=
userdic
[
'username'
]
useremail
=
userdic
[
'email'
]
...
...
@@ -80,7 +88,8 @@ def update_cache_for_login(username, passwd, passwd_store_on=0, file='./codiacli
raise
def
cache_load
(
file
=
'./codiaclient.cache'
):
def
cache_load
():
file
=
variables
[
'tmpPath'
]
if
not
variables
[
'cache_on'
]:
report
(
"Invalid reference of function 'cache_load'."
,
1
)
return
False
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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