-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
55 lines (36 loc) · 1.44 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
from utils import database
USER_CHOICE = """
Welcome to the password management system.
Please enter you choice :
'a' : to add a new password for your app
'l' : to list all the applications that you saved passwords for :
'd' : to delete the password and it's corresponding application from the directory
'q' : to quit
Your choice :
"""
def menu():
database.create_password_table()
user_input = input(USER_CHOICE)
while user_input != 'q':
if user_input == 'a':
prompt_add_password()
elif user_input == 'l':
prompt_list_passwords()
elif user_input == 'd':
prompt_delete_password()
user_input = input(USER_CHOICE)
def prompt_add_password():
user_application = input('Please enter the application for which the password should be saved : ')
user_password = input('Please enter the password to be saved : ')
database.add_password(user_application,user_password)
def prompt_list_passwords():
passwords = database.list_passwords()
if len(passwords) == 0:
print('No saved passwords are available')
for password in passwords:
print(f"Password for application {password['application']} : {password['password']}")
def prompt_delete_password():
application_to_be_deleted = input('Enter the application for which the password is to be deleted')
database.delete_password(application_to_be_deleted)
if __name__ == '__main__':
menu()