Update __init__.py

This commit is contained in:
midoks
2021-01-30 14:54:37 +08:00
parent fe7853781b
commit 024f8bd62f
+9
View File
@@ -91,6 +91,12 @@ def isLogined():
# print('isLogined', session)
if 'login' in session and 'username' in session and session['login'] == True:
return True
if os.path.exists('data/api_login.txt'):
content = mw.readFile('data/api_login.txt')
session['login'] = True
session['username'] = content
os.remove('data/api_login.txt')
return False
@@ -205,6 +211,9 @@ def doLogin():
session['login'] = True
session['username'] = userInfo['username']
#print('do_login', session)
# fix 跳转时,数据消失,可能是跨域问题
mw.writeFile('data/api_login.txt', userInfo['username'])
return mw.returnJson(True, '登录成功,正在跳转...')