def login(): if request.method == "GET": return render_template("login.html") else: if request.form['username'] != "" and request.form['password'] != "": if operations.login(request.form['username'], request.form['password']): template = env.get_template('Dashboard.html') connection = operations.get_connection() cursor = connection.cursor() cursor.execute( "select id,nume,prenume,adresaProceduralaJudet,adresaProceduralaOras,cnp from lexbox.instance order by instance.dataProcesVerbal desc limit 15" ) records = cursor.fetchall() connection.close() results = [] for i in records: results.append( Record(i[1], i[2], i[3], i[4], i[5], operations.getDownloadLink(i[0]))) template.records = results return operations.setToken(template.render(records=results), request.form['username'], False) return render_template("loginFailed.html") else: return render_template("login.html")
def main(): while True: load_bank_data() header() account = login() if account: clear_terminal() message = str admin = accounts_list[account]['admin'] name = accounts_list[account]['name'] balance = accounts_list[account]['balance'] header(name) while account: option_typed = menu_options(account) exec_option(option_typed, balance, admin) else: clear_terminal() message = "Acesso negado. Verifique conta e senha" show_message(message) clear_terminal() show_message(message)
def test_login_track_weight_logout_case1(self): login_result = login(self.browser, "*****@*****.**", "Wgl09026") if login_result: self.fail("Unable to login!") update_weight_result = track_weight(self.browser, 53) if update_weight_result: self.fail("Track weight failed!") result_logout = logout(self.browser) if result_logout: self.fail("Can't logout after update weight!") pass
def test_login_add_food_logout_case1(self): login_result = login(self.browser, "*****@*****.**", "Wgl09026") if login_result: self.fail("Unable to login!") add_breakfast_result = add_food_to_meal(self.browser, "breakfast", "bread") if add_breakfast_result: self.fail("Add breakfast failed!") add_lunch_result = add_food_to_meal(self.browser, "lunch", "fish") if add_lunch_result: self.fail("Add lunch failed!") result_logout = logout(self.browser) if result_logout: self.fail("Can't logout after add breakfast and lunch!") pass
from operations import login, insert_user, delete_user, update_user, report_on_customers, register while True: print("Home Screen:\n\t1.Login\n\t2.Register\n\t3.quit") option = input("Enter option from above list :") if option == "1": flag = login() if flag: while True: print( "Customer menu:\n\t1.Create\n\t2.Delete\n\t3.update\n\t4.report\n\t5.quit" ) opt = input("Enter one operation you want to perform :") if opt == "1": insert_user() elif opt == "2": delete_user() elif opt == "3": update_user() elif opt == "4": report_on_customers() elif opt == "5": print("Thank you") break else: print("Wrong option") elif option == "2": flag2 = register() if flag2: while True: print(
'passwd': 'rwy123', 'db': 'Cloudy_DB', 'charset': "utf8" } dirver_path = r'driver\chromedriver2.37.exe' browser = webdriver.Chrome(executable_path=dirver_path) browser.implicitly_wait(TIME_TO_WAIT) browser.get(homepage) db = my_db.CloudDB(**db_config) # print db.query('select * from all_branchstore_details limit 1') # 登陆 operations.login(browser, **login_info) # ###################################################################################################################### # 进入网吧管理列表 operations.skip_to_bar_manage_list(browser) # ###################################################################################################################### # 进入网吧管理 operations.skip_to_bar_manage(browser) # ###################################################################################################################### from case import case_sys_setup # # 进入设置页面 例如:系统设置-计费设置 # operations.skip_to_setting_page(browser, path=[u'系统设置', u'计费设置']) # # ######################################################################################################################