SHOW:
|
|
- or go back to the newest paste.
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 | username = raw_input("Username: ") | |
17 | - | username = raw_input("Username: ") |
17 | + | |
18 | logged = logged - 1 | |
19 | if logged == 0: | |
20 | print "Username/password attempts exceeded. System is now locked." | |
21 | quit() | |
22 | username = raw_input("Username: ") | |
23 | ||
24 | - | password = raw_input("Password: ") |
24 | + | password = raw_input("Password: ") |
25 | while password != "pass": | |
26 | logged = logged - 1 | |
27 | if logged == 0: | |
28 | print "Username/password attempts exceeded. System is now locked." | |
29 | quit() | |
30 | password = raw_input("Password: ") | |
31 | ||
32 | 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." | |
33 | ||
34 | while logged > 0: | |
35 | command = raw_input(">>> ") | |
36 | if command == "Lock": | |
37 | logged = 0 | |
38 | if logged == 0: | |
39 | print "System locked via user input." |