Update app.py
This commit is contained in:
@@ -1,31 +1,55 @@
|
|||||||
import database
|
import database
|
||||||
|
|
||||||
MENU = """-- Netflox --
|
|
||||||
|
|
||||||
1) Sign Up.
|
|
||||||
2) Log in.
|
|
||||||
0) Exit.
|
|
||||||
|
|
||||||
Your Selection: """
|
|
||||||
|
|
||||||
|
|
||||||
def menu():
|
def menu():
|
||||||
conn = database.conn()
|
|
||||||
|
|
||||||
while (user_input := input(MENU)) != "0":
|
menu_interface = """-- Netflox --
|
||||||
print(user_input)
|
1) Sign Up.
|
||||||
if user_input == "1": # if
|
2) Log in.
|
||||||
|
0) Exit.
|
||||||
|
Your Selection: """
|
||||||
|
|
||||||
|
while (user_input := input(menu_interface)) != "0":
|
||||||
|
if user_input == "1":
|
||||||
|
print("Sign up")
|
||||||
name = input("Enter your name: ")
|
name = input("Enter your name: ")
|
||||||
email = input("Enter your e-mail: ")
|
email = input("Enter your e-mail: ")
|
||||||
password = input("Enter your password: ")
|
password = input("Enter your password: ")
|
||||||
|
database.create_user(name, email, password)
|
||||||
database.create_user(conn, name, email, password)
|
|
||||||
|
|
||||||
elif user_input == "2":
|
elif user_input == "2":
|
||||||
|
print("Log in")
|
||||||
email = input("Enter your e-mail: ")
|
email = input("Enter your e-mail: ")
|
||||||
password = input("Enter your password: ")
|
password = input("Enter your password: ")
|
||||||
|
if database.log_in(email, password):
|
||||||
|
break
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print("Invalid input, please try again")
|
print("Invalid input, please try again")
|
||||||
|
|
||||||
|
|
||||||
|
def client():
|
||||||
|
|
||||||
|
client_interface = """Welcome
|
||||||
|
1) Search products.
|
||||||
|
2) My history.
|
||||||
|
3) Messages.
|
||||||
|
0) Exit
|
||||||
|
Your Selection: """
|
||||||
|
|
||||||
|
while (user_input := input(client_interface)) != "0":
|
||||||
|
if user_input == "1":
|
||||||
|
|
||||||
|
search_interface = """Order by
|
||||||
|
1) Name
|
||||||
|
2) Actor
|
||||||
|
3) Director
|
||||||
|
4) Date
|
||||||
|
5)
|
||||||
|
6)
|
||||||
|
7)
|
||||||
|
Your Selection: """
|
||||||
|
|
||||||
|
|
||||||
menu()
|
menu()
|
||||||
|
client()
|
||||||
|
|||||||
Reference in New Issue
Block a user