Challenge 35
🗝️
Login System
Your goal is to simulate a simple - and super insecure - login system. A text file has account credentials stored in the form username,password, for example, abc,123. Each set of credentials will be on a new line
You can create a text file with the following credentials:
admin,p@ssw0rd abc,123 bill,apple steve,woz alan,tur!ng fred,flintstone fbi,cia
Using this data, expected behaviour would be as follows:
Examples:
Entering "abc" & 123 would output Welcome back, abc!
Entering "ab" & 123 would output Account "ab" not found
Entering "abc" & 456 would output Wrong password
Extension:
Allow the user 3 chances to login, with the program quitting if all 3 attempts are unsuccessful
For real applications, it is considered bad practice to provide specific reasons (e.g. "username doesn't exist" or "incorrect password") for the failed login attempts. Instead, a simple "login unsuccessful" without giving a specific reason is more secure. Why do you think that is?