Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Set username and password equal to something incorrect so that the prompt runs at least once
- # Set logged count to any number - this is how many attempts will be made until system quits.
- # 1 == 1 loop keeps program running forever.
- # CONTINUING ISSUES: logged - 1
- while 1 == 1:
- password = ""
- username = ""
- logged = 4
- print "Welcome. Please enter a username and password to login.\n"
- while logged != 0:
- username = raw_input("Username: ")
- while username != "user":
- logged = logged - 1
- if logged == 0:
- print "Username/password attempts exceeded. System is now locked."
- quit()
- username = raw_input("Username: ")
- password = raw_input("Password: ")
- while password != "pass":
- logged = logged - 1
- if logged == 0:
- print "Username/password attempts exceeded. System is now locked."
- quit()
- password = raw_input("Password: ")
- print "\nWelcome " + username.upper() + ". Type 'Lock' to lock system at any time. You will be required to re-enter your username and password for security purposes."
- while logged > 0:
- command = raw_input(">>> ")
- if command == "Lock":
- logged = 0
- if logged == 0:
- print "System locked via user input."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement