Advertisement
Guest User

Untitled

a guest
Mar 6th, 2017
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.53 KB | None | 0 0
  1. from colorama import init, Fore, Style
  2. import os
  3. import sys
  4.  
  5. # initializes colorama
  6. init()
  7.  
  8. # sets runtime true
  9. runtime = bool([1])
  10.  
  11. # sets user and pass
  12. userName = 'James'
  13. passWord = '123abc'
  14. nameInput = ''
  15. passInput = ''
  16.  
  17. # colorama colors and reset vars
  18. red = Fore.RED + Style.BRIGHT
  19. green = Fore.GREEN + Style.BRIGHT
  20. cyan = Fore.CYAN + Style.BRIGHT
  21. magenta = Fore.MAGENTA + Style.BRIGHT
  22. reset = Style.RESET_ALL
  23.  
  24. def setToZero():
  25.     global nameInput
  26.     global passInput
  27.     nameInput = ''
  28.     passInput = ''
  29.  
  30. # clears screen and prints "LOGIN" in cyan, also the meat and potatos of the program :)
  31. os.system('cls')
  32. print(cyan + '\t\t\tPLEASE LOGIN' + reset)
  33.  
  34. while (runtime):
  35.     # resets color and brightness
  36.     sys.stdout.write(reset)
  37.    
  38.     # user and pass input from user
  39.     while not nameInput:
  40.         nameInput = input('USERNAME: ')
  41.         os.system('cls')
  42.     while not passInput:
  43.         passInput = input('PASSWORD: ')
  44.         os.system('cls')
  45.        
  46.     # clears screen
  47.     os.system('cls')
  48.    
  49.     # checks if username and password are correct
  50.     if (nameInput == userName and passInput == passWord):
  51.         break
  52.     else:
  53.         print(red + '\t\t\tLOGIN UNSUCCESSFUL' + reset)
  54.         setToZero()
  55.        
  56. os.system('cls')
  57.  
  58. # prints "LOGIN SUCCESSFUL" and a greeting including username
  59. print(green + '\t\t\tLOGIN SUCCESSFUL\n\a')
  60. print(cyan + 'Welcome ' + magenta + userName + \
  61.       cyan + ', How are you today?' + reset)
  62. input('\nPress ENTER to exit. . .')
  63. os.system('cls')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement