-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcode.py
More file actions
32 lines (24 loc) · 770 Bytes
/
code.py
File metadata and controls
32 lines (24 loc) · 770 Bytes
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
import json
from menu import menu
def login(i_username, i_password):
with open('data.json', 'r') as j_f:
data = json.load(j_f)
credentials = data['credentials']
username = credentials['username']
password = credentials['password']
if i_username != username or i_password != password:
return False
else:
return True
def main():
print("\t"*3 + "-"*5 + "LOGIN" + "-"*5)
username = input('Enter username: ').strip()
password = input('Enter password: ').strip()
if login(username, password):
print('Logged in sucessfully!')
menu()
else:
print('Please enter correct username & password')
return main()
if __name__ == "__main__":
main()