def startapp(): '''this "main" is application entry''' try: trigger.triggerman(protect=True) login.login() except Exception as e: ef = traceback.format_exc() (logger, fh) = logs.log(log_file=configs.CONFIG['logfile_error'], log_fmode="a") logger.error("{ error }:%s \n %s" % (e, ef)) logger.removeHandler(fh)
def wrapper(*args, **kwargs): f = open(db_path + 'user_status.txt', 'r') content = f.readlines() try: if len(content) > 0: res = func(*args, **kwargs) return res except Exception: print('\033[1;31;0m未登录,请登录!\033[0m') login.login() func(*args, **kwargs)
def run(): while True: acc_data = login.login(user_data) if user_data['login_status']: user_data['account_data'] = acc_data # user_operate(user_data) return acc_data
def processLoginCallBack(self, event=None): if self.randImage: # 获取前台用户输入的输入证码 randCode = self.randImage.randCode.get() if randCode: loginResult = login.login(ht=self.ht, username=self.userInfo[0], password=self.userInfo[1], randCode=randCode, rand=self.login_rand, check_rand_status=self.check_rand_status) if loginResult: # 登录成功,关闭登框 self.randImage.quit() # 得到性能配置中设定是否更新车站编码属性,默认是Y,表更新 update_stations = self.performanceInfo.get('update_stations', 'Y') if update_stations and update_stations == "Y": # 更新城市编码表 query.updateCityCode(self.ht) # 装载列车站点编码 self.allStationCodes = query.getAllStationCodes() # 获取默认的列车查询信息 defaultQueryParams = query.getDefaultQueryParams() # 载入用户设定的所有联系人信息 self.contacts = order.getAllContacts(self.ht) # 启动列车查询窗体 self.queryFrame = ui.QueryTrainUI.QueryTrainFrame(initQueryParams=defaultQueryParams) self.queryFrame.selectButton.configure(command=self.queryTrainsCallBack) self.queryFrame.show() else: print("登录失败,请再来一次") self.randImage.refreshImg() self.randImage.randCode.delete(0, tkinter.END) else: print("请输入验证码")
def login(self, head_dic): if head_dic["cmd_type"] == "login": login_res = login.login(head_dic["res"][0], head_dic["res"][1]) global user_account global user_file user_account = head_dic["res"][1] user_file = settings.USER_FILE % user_account self.send_msg(cmd_type="login", res=[login_res[0], login_res[1]])
def payment(costs_amount): pay_acc_data = login.login(user_data) # print(pay_acc_data) pay_status = transaction.transaction(pay_acc_data, 'payment', costs_amount) # print(pay_status) if pay_acc_data and pay_status: logger.logger( 'transaction', pay_acc_data['account'], "账户 %s 购物消费 %s 元" % (pay_acc_data['account'], costs_amount)) return pay_acc_data, pay_status
def main(): """ 验证连接 程序的入口:登录认证+日志记录,这里使用反射相关的知识 :return: """ if dispatch.Dispatch().secure_verify() == False: print("\033[1;31;0m非安全连接,连接失败!\n\033[0m") return False print("\033[1;31;0m安全连接!\n\033[0m") while True: print("""注册:1 登录:2 退出:Q""") # 用户注册,用户名只能是英文+数字 flag = input("请选择您的操作编码:").strip() if flag.upper() == 'Q': break elif flag == '1': # 登录认证,并接收相关的信息 ret = register.register() # 日志记录 elif flag == '2': # 登录认证,并接收相关的信息 ret = login.login() # print("ret = ",ret) # 日志记录 # 登录成功 if ret['state'] == 1: func = ret['person_info']['type'] if hasattr(dispatch.Dispatch(), func): func = getattr(dispatch.Dispatch(), func) func(ret) break else: print("\033[1;31;0m该用户类型不存在,请联系管理员!\n\033[0m") break else: print('\033[1;31;0m请输入正确的操作编码!\n\033[0m') return
def main(): print('main') login.login()
#!/usr/bin/env python #coding:utf-8 # import os, sys BASEDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(BASEDIR) from core import login, account, cashin, shopping from conf import * import sys, os, time print(""" Welcome to My Shop, Please Login """) login_status = login.login() if login_status == 0: while True: print(""" 1. 修改额度 2. 购买物品 3. 提现 4. 转账 5. 查看消费记录 6. 还款 7. 查看购买物品 8. 账号操作 9. 登出操作 """) opstat = raw_input("请选择操作的内容:").strip() try:
def run(): login.login(user_data) if user_data['is_authenticated']: interactive(user_data)
def own_login(self): return login.login("lecturer")
def run(): acc_data = login.login(user_data, acc_logger) if user_data['is_authenticated']: user_data['account_data'] = acc_data interactive(user_data)
#! usr/bin/python # coding:UTF-8 import sys sys.path.append('..') from core import apis from core import login def delPostLevel(): """ 删除我的企业 - 职级 """ roles = apis.getPostLevel() print roles for i in roles: print "开始删除" + str(i) + "的职级" apis.delPostLevel(i) if __name__ == '__main__': login.login() delPostLevel()
#!/usr/bin/python import wx import gui.spotify_gui as spotify_gui import core.audio_player as audio_player import core.login as login if __name__ == "__main__": app = wx.App() ui = spotify_gui.SpotifyGUI(None) session = login.get_session() player = audio_player.AudioPlayer(session, ui) un, pwd = login.get_username_password() login.login(session, un, pwd) ui.init_gui(player) app.MainLoop()
def own_login(self): return login.login("student")