Guest User

Untitled

a guest
May 29th, 2018
401
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.83 KB | None | 0 0
  1. import os
  2. import sys
  3.  
  4. def drawBar():
  5.     print "---------------------------------------"
  6.  
  7. def main():
  8.     userList = ['JB']
  9.     passWordList = {'JB':'test'}
  10.     userName = ''
  11.     passWord = ''
  12.     while True:
  13.         drawBar()
  14.         userName = raw_input("Username: ")
  15.         if userName not in userList:
  16.             drawBar()            
  17.             print "That is not a valid username"
  18.             raw_input("Press ENTER to continue...")
  19.             continue
  20.         passWord = raw_input("Password: ")
  21.         if passWord != passWordList[userName]:
  22.             drawBar()
  23.             print "That is an incorrect password"
  24.             raw_input("Press ENTER to continue...")
  25.             continue
  26.         #drawBar()
  27.         #print "You have successfully logged on as",userName
  28.         #raw_input("Press ENTER to continue...")
  29.         while True:
  30.             drawBar()
  31.             print "Welcome", userName
  32.             print "L:Log Out    C:Change Password    Q:Quit    U:Change Username"
  33.             choiceList = ['l','c','q','u']
  34.             while True:
  35.                 drawBar()
  36.                 choice = raw_input("What would you like to do today?: ")
  37.                 choice = choice.lower()
  38.                 if choice in choiceList:
  39.                     break
  40.                 else:
  41.                     drawBar()
  42.                     print "That is not a valid choice"
  43.             if choice == 'l':
  44.                 drawBar()
  45.                 print "You have successfully logged out"
  46.                 raw_input("Press ENTER to continue")
  47.                 break
  48.             elif choice == 'c':
  49.                 drawBar()
  50.                 newPass = raw_input("New Password: ")
  51.                 passWordList[userName] = newPass
  52.                 print "You have successfully changed your password..."
  53.                 raw_input("Press ENTER to continue")
  54.             elif choice == 'q':
  55.                 drawBar()
  56.                 print "You are now quitting..."
  57.                 raw_input("Press ENTER to continue")
  58.                 sys.exit(1)
  59.             elif choice == 'u':
  60.                 drawBar()
  61.                 newUsername = raw_input("New Username: ")
  62.                 if newUsername in userList:
  63.                     print "That username is already taken"
  64.                     raw_input("Press ENTER to continue")
  65.                 else:
  66.                     userPos = userList.index(userName)
  67.                     userList[userPos] = newUsername
  68.                     passWordList.update({newUsername:passWordList[userName]})
  69.                     del passWordList[userName]
  70.                     userName = newUsername
  71.                     print "You have successfully changed your username"
  72.                     raw_input("Press ENTER to Continue")
  73.                
  74.                    
  75.                    
  76.            
  77.            
  78. main()
Add Comment
Please, Sign In to add comment