-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
64 lines (50 loc) · 1.17 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#logic related to project
import sys
from dbhelper import DB_helper
class Flipkart:
def __init__(self):
#connect to the database
#go to db.py
self.db=DB_helper()
self.menu()
def menu(self):
user_input=input("""
1.Enter 1 to register
2.Enter 2 to login
3.Anything else to leave
""")
#routing code-
if user_input=="1":
self.register()
elif user_input=="2":
self.login()
else:
sys.exit(1000)
def login_menu(self): #for the users who have successfully logged in.
input("""
1. Enter 1 to see profile.
2. Enter 2 to edit profile.
3. Enter 3 to delete profile.
4. Enter 4 to logout.
""")
def register(self):
name=input("Enter the name:")
email=input("Enter e-mail:")
password=input("Enter the password:")
response=self.db.register(name,email,password)
if response:
print("Registration Successfull.")
else:
print("Registration Failed.")
self.menu()
def login(self):
email=input("Enter e-mail:")
password=input("Enter password:")
data=self.db.search(email,password)
if len(data)==0:
print("Incorrect data.")
self.login()
else:
print("Hello",data[0][1])
self.login_menu()
obj=Flipkart()