-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
106 lines (91 loc) · 2.74 KB
/
main.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
from auth.auth import store_user, verify_user, delete_user
from db.encryptorDb import client
def interface():
if client is not None:
print("\n \U0001F7E2 Connection to MongoDB server is open.")
option = int(input(
'''
------------------------------------
Choose an Option
------------------------------------
1) Create a User
2) Verify a User
3) Delete a User
0) Exit
\u2192 '''))
while True:
if option == 1:
username = input("Enter the Username: ")
password = input("Enter the Password: ")
store_user(username, password)
restart = int(input('''
------------------------------------
Do you want to continue?
------------------------------------
1) Yes
2) No
\u2192 '''))
if restart == 1:
interface()
elif restart == 2:
print("--------Goodbye!--------")
break
else:
print("--------Invalid Input!--------")
break
break
elif option == 2:
username = input("Enter the Username: ")
password = input("Enter the Password: ")
verify_user(username, password)
restart = int(input('''
------------------------------------
Do you want to continue?
------------------------------------
1) Yes
2) No
\u2192 '''))
if restart == 1:
interface()
elif restart == 2:
print("--------Goodbye!--------")
break
else:
print("--------Invalid Input!--------")
break
break
elif option == 3:
username = input("Enter the Username: ")
password = input("Enter the Password: ")
delete_user(username, password)
restart = int(input('''
------------------------------------
Do you want to continue?
------------------------------------
1) Yes
2) No
\u2192 '''))
if restart == 1:
interface()
elif restart == 2:
print("--------Goodbye!--------")
break
else:
print("--------Invalid Input!--------")
break
break
elif option == 0:
print("--------Goodbye!--------")
break
else:
print("--------Invalid Input!--------")
interface()
break
if __name__ == '__main__':
interface()
client.close()
client = None
if client is not None:
print("\n \U0001F7E2 Connection to MongoDB server is open.")
else:
print("\n \U0001F534 Connection to MongoDB server is closed.")