Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from colorama import init, Fore, Style
- import os
- import sys
- # initializes colorama
- init()
- # sets runtime true
- runtime = bool([1])
- # sets user and pass
- userName = 'James'
- passWord = '123abc'
- nameInput = ''
- passInput = ''
- # colorama colors and reset vars
- red = Fore.RED + Style.BRIGHT
- green = Fore.GREEN + Style.BRIGHT
- cyan = Fore.CYAN + Style.BRIGHT
- magenta = Fore.MAGENTA + Style.BRIGHT
- reset = Style.RESET_ALL
- def setToZero():
- global nameInput
- global passInput
- nameInput = ''
- passInput = ''
- # clears screen and prints "LOGIN" in cyan, also the meat and potatos of the program :)
- os.system('cls')
- print(cyan + '\t\t\tPLEASE LOGIN' + reset)
- while (runtime):
- # resets color and brightness
- sys.stdout.write(reset)
- # user and pass input from user
- while not nameInput:
- nameInput = input('USERNAME: ')
- os.system('cls')
- while not passInput:
- passInput = input('PASSWORD: ')
- os.system('cls')
- # clears screen
- os.system('cls')
- # checks if username and password are correct
- if (nameInput == userName and passInput == passWord):
- break
- else:
- print(red + '\t\t\tLOGIN UNSUCCESSFUL' + reset)
- setToZero()
- os.system('cls')
- # prints "LOGIN SUCCESSFUL" and a greeting including username
- print(green + '\t\t\tLOGIN SUCCESSFUL\n\a')
- print(cyan + 'Welcome ' + magenta + userName + \
- cyan + ', How are you today?' + reset)
- input('\nPress ENTER to exit. . .')
- os.system('cls')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement