From 024f8bd62f88993951ee2a6317abefe4604191c0 Mon Sep 17 00:00:00 2001 From: midoks Date: Sat, 30 Jan 2021 14:54:37 +0800 Subject: [PATCH] Update __init__.py --- route/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/route/__init__.py b/route/__init__.py index d78d872ba..29d6a4d1b 100755 --- a/route/__init__.py +++ b/route/__init__.py @@ -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, '登录成功,正在跳转...')