Advertisement
Guest User

Untitled

a guest
Jan 21st, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. # Set username and password equal to something incorrect so that the prompt runs at least once
  2. # Set logged count to any number - this is how many attempts will be made until system quits.
  3. # 1 == 1 loop keeps program running forever.
  4. # CONTINUING ISSUES: logged - 1
  5.  
  6. while 1 == 1:
  7.  
  8. password = ""
  9. username = ""
  10. logged = 4
  11.  
  12. print "Welcome. Please enter a username and password to login.\n"
  13.  
  14. while logged != 0:
  15.  
  16. while username != "user":
  17. username = raw_input("Username: ")
  18. logged = logged - 1
  19. if logged == 0:
  20. print "Username/password attempts exceeded. System is now locked."
  21. quit()
  22.  
  23. while password != "pass":
  24. password = raw_input("Password: ")
  25. logged = logged - 1
  26. if logged == 0:
  27. print "Username/password attempts exceeded. System is now locked."
  28. quit()
  29.  
  30. 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."
  31.  
  32. while logged > 0:
  33. command = raw_input(">>> ")
  34. if command == "Lock":
  35. logged = 0
  36. if logged == 0:
  37. print "System locked via user input."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement