def printUserTable(menuChoose): os.system("clear") db = dbSystem('loginSystem.db') sql = "SELECT * FROM user WHERE userID = (?)" record = dbSystem.execute(db, sql, (menuChoose, )) oneUserTable = from_db_cursor(record) print(oneUserTable)
def printUsersTable(sql): os.system("clear") db = dbSystem('loginSystem.db') rowFromDB = dbSystem.execute(db, sql) mytable = from_db_cursor(rowFromDB) del db print(mytable)
def createNewAccountUIinput(): print("===========Create New Account===========") newUser = input("Insert username: "******"stty -echo") newPassword = input("Insert password: "******"stty echo") newPermission = input("\nInsert permission: ") db = dbSystem('loginSystem.db') dbSystem.registerQuery(db, newUser, newPassword, newPermission) del db
def userExist(): os.system("clear") print("===========Login===========") globalVars.username = input("Enter username: "******"stty -echo") globalVars.password = input("Enter password: "******"stty echo") print("\n") db = dbSystem('loginSystem.db') dbSystem.checkConnectiton(db, globalVars.username, globalVars.password) del db
def newUser(): os.system("clear") print("==========Register==========") globalVars.username = input("Enter username: "******"stty -echo") globalVars.password = input("Enter password: "******"stty echo") print("\n") db = dbSystem('loginSystem.db') dbSystem.registerQuery(db, globalVars.username, globalVars.password) del db return userExist()
def deleteAccount(userID): db = dbSystem('loginSystem.db') try: dbSystem.deleteAccount(db, userID) del db except: print("Error!") if globalVars.adminMOD: return modifyExistAccountUI() else: return accountDetailsUI(globalVars.usernameID) finally: os.system("clear") print("Modify succesfully") if globalVars.adminMOD: return modifyExistAccountUI() else: return accountDetailsUI(globalVars.usernameID)
def modifyUsernameUI(userID): os.system("clear") print("================Modify Username===============") newUsername = input("Insert username: "******"username", userID, newUsername) del db except: print("Error!") if globalVars.adminMOD: return modifyExistAccountUI() else: return accountDetailsUI(globalVars.usernameID) finally: os.system("clear") print("Modify succesfully") if globalVars.adminMOD: return modifyExistAccountUI() else: return accountDetailsUI(globalVars.usernameID)
def modifyPasswordUI(userID): os.system("clear") print("================Modify Password===============") os.system("stty -echo") newPassword = input("Insert password: "******"stty echo") db = dbSystem('loginSystem.db') try: dbSystem.updateDB(db, "password", userID, newPassword) del db except: print("Error!") if globalVars.adminMOD: return modifyExistAccountUI() else: return accountDetailsUI(globalVars.usernameID) finally: os.system("clear") print("Modify succesfully") if globalVars.adminMOD: return modifyExistAccountUI() else: return accountDetailsUI(globalVars.usernameID)