Esempio n. 1
0
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)
Esempio n. 2
0
def printUsersTable(sql):
    os.system("clear")
    db = dbSystem('loginSystem.db')
    rowFromDB = dbSystem.execute(db, sql)
    mytable = from_db_cursor(rowFromDB)
    del db
    print(mytable)
Esempio n. 3
0
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
Esempio n. 4
0
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
Esempio n. 5
0
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()
Esempio n. 6
0
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)
Esempio n. 7
0
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)
Esempio n. 8
0
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)