def to_beta(self): try: userInfo = json.loads(public.ReadFile('data/userInfo.json')) p_data = {} p_data['uid'] = userInfo['uid']; p_data['access_key'] = userInfo['access_key'] p_data['username'] = userInfo['username'] public.HttpPost(public.GetConfigValue('home') + '/api/panel/to_beta',p_data,5) except: pass
def to_not_beta(self,get): try: userInfo = json.loads(public.ReadFile('data/userInfo.json')) p_data = {} p_data['uid'] = userInfo['uid']; p_data['access_key'] = userInfo['access_key'] p_data['username'] = userInfo['username'] result = public.HttpPost(public.GetConfigValue('home') + '/api/panel/to_not_beta',p_data,5) try: return json.loads(result) except: return public.returnMsg(False,'AJAX_CONN_ERR') except: return public.returnMsg(False,'AJAX_USER_BINDING_ERR')
def check_user_auth(self,get): m_key = 'check_user_auth' if m_key in session: return session[m_key] u_path = 'data/userInfo.json' try: userInfo = json.loads(public.ReadFile(u_path)) except: if os.path.exists(u_path): os.remove(u_path) return public.returnMsg(False,'AJAX_USER_BE_OVERDUE') pdata = {'access_key':userInfo['access_key'],'secret_key':userInfo['secret_key']} result = public.HttpPost(public.GetConfigValue('home') + '/api/panel/check_auth_key',pdata,3) if result == '0': if os.path.exists(u_path): os.remove(u_path) return public.returnMsg(False,'AJAX_USER_BE_OVERDUE') if result == '1': session[m_key] = public.returnMsg(True,'AJAX_USER_IS_VALID!') return session[m_key] return public.returnMsg(True,result)