-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
executable file
·116 lines (76 loc) · 3.11 KB
/
run.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
107
108
109
110
111
112
113
114
115
116
#!/usr/bin/env python3.6
from password import Password
def create_password(flo,me,beat,joby):
new_password = Password(flo,me,beat,joby)
return new_password
def save_passwords(password):
password.save_Password()
def del_password(password):
password.delete_password()
def find_password(user_name):
return Password.find_by_user_name(user_name)
def check_existng_passwords(user_name):
return Password.password_exist(user_name)
def display_passwords():
return Password.display_passwords()
def main():
print("Hello,What is your name?")
user_name = input()
print(f"Hello {user_name}. What would u like to do?")
print ('\n')
while True:
print("Use these short codes : cc - create a credentials, del - delete credential dc - display password, fc -find a password, ex -exit the password list ")
short_code = input().lower()
if short_code == 'cc':
print("Credential")
print("-"*10)
print("first_name")
f_name = input()
print("last_name")
last_name = input()
print("user_name")
u_user_name = input()
print("password")
p_password = input()
save_passwords(create_password(f_name,last_name,u_user_name,p_password))
print ('\n')
print(f"New credential {f_name} {last_name} created")
print ('\n')
elif short_code == 'dc':
if display_passwords():
print("Here is a list of all your passwords")
print('\n')
for password in display_passwords():
print(f"{password.first_name} {password.last_name} {password.user_name} {password.password}")
print('\n')
else:
print('\n')
print("You dont seem to have any passwords saved yet")
print('\n')
elif short_code == 'del':
print("Enter the username you want to delete")
search_user_name = input()
if check_existng_passwords(search_user_name):
search_password = find_password(search_user_name)
del_password(search_password)
print("account successfully deleted!")
else:
print("That account does not exist")
elif short_code == 'fc':
print("Enter the username you want to search for")
search_user_name = input()
if check_existng_passwords(search_user_name):
search_password = find_password(search_user_name)
print(f"{search_password.first_name} {search_password.last_name}")
print('-' * 20)
print(f"user_name.......{search_password.user_name}")
print(f"password.......{search_password.password}")
else:
print("That password does not exist")
elif short_code == "ex":
print("Bye")
break
else:
print("I really didn't get that. Please use the short codes")
if __name__ == '__main__':
main()