-
Notifications
You must be signed in to change notification settings - Fork 1
/
passwordmanagerupdate2.py
82 lines (66 loc) · 2.48 KB
/
passwordmanagerupdate2.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
import os
MasterKeyList = ["1705"]
f = open("passwordslist.txt", "x")
# Login stage
def login():
while True:
try:
choice = int(input("1)Login 2)Register 3)Quit --> "))
except ValueError:
print("Please choose a whole number either 1, 2 or 3")
continue
# login
if choice == 1:
MasterKey = input("Enter your master key to continue:")
if MasterKey in MasterKeyList:
print ("Success")
main()
else:
print ("Incorrect")
login()
# Registration stage
elif choice ==2:
if choice ==2:
age = float(input("Please enter your age: "))
if age < 13:
print("no")
end
elif age > 13:
print("Welcome please create your master key,")
print("this key will be required the next time you login")
print("take note of this key as you will be unable to recover it if lost.")
print("")
print("")
MasterKey = input("Enter your master Key:")
print("Your master key has been successfully created!")
MasterKeyList.append(MasterKey)
# Quit option
elif choice ==3:
print("Thank you for using SmartPass, bye now")
os.remove("passwordslist.txt")
exit()
else:
print("Invalid input, please try again")
def main():
LoggedIn = True
print("You are currently logged in to SmartPass")
while LoggedIn:
choice = int(input("1)Add password 2)View password 3)Logout: "))
if choice == 1:
back = "menu"
print("type 'menu' to go back")
f = open("passwordslist.txt", "a")
newpassword = input("Type the password would you like to add? ")
f.write(newpassword)
if back == newpassword:
main()
elif choice == 2:
f = open("passwordslist.txt", "r")
print(f.read())
# Logout and quit program
if choice == 3:
LoggedIn = False
print("Logging out of your session....")
os.remove("passwordslist.txt")
print("Hello")
login()