-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDio Bug testing
157 lines (145 loc) · 6.58 KB
/
Dio Bug testing
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
import time
file = open("Logins.txt","r")
logins = []
for line in file:
user = line.strip("\n")
user = user.split(",")
logins.append(user)
file.close()
auth = False
end = False
while end == False:
option = input("1.Log In\n2.#\n")
while option != "1" and option != "2":
option = input("Invalid entry, please try again\n")
if option == "1":
valid = False
found = False
count = 0
while True:
count += 1
username = input("Username:")
if username == "#":
print("\nReturning to previous page\n")
time.sleep(1)
break
for i in logins:
if i[0] == username:
found = True
if i[1] != "-":
valid = True
break
if count == 3 and valid == False:
print("\nYou appear to be having trouble with your username, please contact me.")
end = True
break
if found == True and valid == False:
print("You appear to be entering an authentication code. If so, please enter # to go back, and select # instead.")
print("If not, your username is incorrect. Please try again, ensuring it is spelt correctly and capital letters are in the right places.\n")
elif found == False:
print("Your username is not recognised. \nPlease try again, ensuring it is spelt correctly and capital letters are in the right places.\n")
else:
break
if valid == True:
count = 3
while True:
count -= 1
password = input("Password:")
if password == "#":
print("\nReturning to previous page\n")
time.sleep(1)
break
if i[1] == password:
auth = True
size = int(i[2])
end = True
print("\nWelcome",username,":)")
break
if count == 0 and auth == False:
print("\nToo many failed attempts, you have been locked out.")
end = True
break
else:
print("Incorrect password, " + str(count) + " attempts remaining.")
if option == "2":
valid = False
count = 0
while True:
count += 1
code = input("Authentication code:")
if code == "#":
print("\nReturning to previous page\n")
time.sleep(1)
break
for i in logins:
if i[0] == code and i[1] == "-":
valid = True
print("Authentication code verrified.\n")
break
if count == 3 and valid == False:
print("\nYou appear to be having trouble with your authentication code, please contact me.")
end = True
break
if valid == False:
print("Your authentication code is not valid, please double check its digits and try again.\n")
else:
break
if valid == True:
check = "N"
while check == "N":
username = input("Please choose a username:")
if username == "#":
print("\nReturning to previous page\n")
time.sleep(1)
break
for i in logins:
while i[0] == username:
username = input("Username is already taken, please choose something else:")
check = input("Please confirm you wish to set your username to " + username + "(Y/N)?").upper()
while check != "Y" and check != "N":
check = input("Invalid input.\nPlease confirm you wish to set your username to " + username + "(Y/N)?").upper()
print("\nHello " + username + "\n")
check = "N"
while check == "N":
password = input("Please set your password:")
if password == "#":
print("\nReturning to previous page\n")
time.sleep(1)
break
print("Please know this password may be accessible to me or others if I cannot work out how to hide them.")
check = input("Do you still wish to set your password to " + password + "(Y/N)?").upper()
while check != "Y" and check != "N":
check = input("Invalid input.\nDo you still wish to set your password to " + password + "(Y/N)?").upper()
print("\nYou are almost set up now, just one last thing.\n")
print("For the best user experience I need to know the width of your screen.")
check = "N"
while check == "N":
print("Please select from the 5 options below which fits your screen best WITHOUT spilling over.\n"\
"(you may wish to change your font size to get the best fit possible)")
print("\n1." + "#"*148 + "\n\n2." + "#"*198 + "\n\n3." + "#"*248 + "\n\n4." + "#"*298 + "\n\n5" + "#"*348)
while True:
try:
size = int(input())
if size > 0 and size < 6:
size = size*50 + 100
break
print("Invalid input, please try again")
except:
print("Invalid input, please try again")
check = input("#"*size + "\nPlease confirm this fits your screen best WITHOUT spilling over (Y/N)?").upper()
while check != "Y" and check != "N":
check = input("Invalid input.\nPlease confirm this fits your screen best WITHOUT spilling over (Y/N)?").upper()
print("\nThank you, now you are all set up.\nAny of the choices you have just made can be changed in settings at any point.\n\nPlease enjoy :)")
end = True
auth = True
for i in logins:
if i[0] == code:
i[0] = username
i[1] = password
i[2] = size
break
file = open("Logins.txt","w")
for i in logins:
add = i[0] + "," + i[1] + "," + str(i[2]) + "\n"
file.write(add)
file.close()