Beispiel #1
0
def mainApp(user):
    print("""
            Welcome to your user portal, %s !

            Your details,
            NAME: %s
            EMAIL: %s
        """ % (user[1], user[1], user[3]))
    print("""
        press p to update any of your details
        press l to logout
        press e to exit
    """)
    inp = input("  Enter Your option:  ")
    while (True):
        if inp == "p":
            db_instance = Database(config)
            db_instance.connect()
            print("""
                    1. Username
                    2. Password
                    3. Email
                """)
            option = int(input("choose an option from above"))
            if (option == 1):
                detail = input("Enter new username: "******"Enter old password: "******"Enter new password: "******"Enter new email: ")
            db_instance.update(user[0], detail, option)
            db_instance.close_Connection()
            mainApp(user)

        #elif inp == "d":
        #    db_instance = Database(config)
        #    db_instance.connect()
        #    db_instance.delete(user[0])

        #    db_instance.close_Connection()
        #    exit()

        elif inp == "l":
            startApp()
            break

        elif inp == "e":
            exit()

        else:
            print("Invalid Inp")
Beispiel #2
0
def reg():
    validEmail, validPass = False, False
    while (not validEmail or not validPass):
        new_user_email = input("Enter Your Email: ")
        validEmail = validateEmail(new_user_email)
        if not validEmail:
            continue
        new_user_name = input("Enter Your username: "******"""Select * from users""")
    rows = db_instance.select_rows("""SELECT * from users""")
    new_user_id = len(rows) + 1
    db_instance.insert(new_user_id, new_user_name, new_user_password,
                       new_user_email)
    db_instance.close_Connection()
    startApp()