Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import sys
- def drawBar():
- print "---------------------------------------"
- def main():
- userList = ['JB']
- passWordList = {'JB':'test'}
- userName = ''
- passWord = ''
- while True:
- drawBar()
- userName = raw_input("Username: ")
- if userName not in userList:
- drawBar()
- print "That is not a valid username"
- raw_input("Press ENTER to continue...")
- continue
- passWord = raw_input("Password: ")
- if passWord != passWordList[userName]:
- drawBar()
- print "That is an incorrect password"
- raw_input("Press ENTER to continue...")
- continue
- #drawBar()
- #print "You have successfully logged on as",userName
- #raw_input("Press ENTER to continue...")
- while True:
- drawBar()
- print "Welcome", userName
- print "L:Log Out C:Change Password Q:Quit U:Change Username"
- choiceList = ['l','c','q','u']
- while True:
- drawBar()
- choice = raw_input("What would you like to do today?: ")
- choice = choice.lower()
- if choice in choiceList:
- break
- else:
- drawBar()
- print "That is not a valid choice"
- if choice == 'l':
- drawBar()
- print "You have successfully logged out"
- raw_input("Press ENTER to continue")
- break
- elif choice == 'c':
- drawBar()
- newPass = raw_input("New Password: ")
- passWordList[userName] = newPass
- print "You have successfully changed your password..."
- raw_input("Press ENTER to continue")
- elif choice == 'q':
- drawBar()
- print "You are now quitting..."
- raw_input("Press ENTER to continue")
- sys.exit(1)
- elif choice == 'u':
- drawBar()
- newUsername = raw_input("New Username: ")
- if newUsername in userList:
- print "That username is already taken"
- raw_input("Press ENTER to continue")
- else:
- userPos = userList.index(userName)
- userList[userPos] = newUsername
- passWordList.update({newUsername:passWordList[userName]})
- del passWordList[userName]
- userName = newUsername
- print "You have successfully changed your username"
- raw_input("Press ENTER to Continue")
- main()
Add Comment
Please, Sign In to add comment