Advertisement
Guest User

Untitled

a guest
Jun 7th, 2016
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.92 KB | None | 0 0
  1. #define launcher
  2. def launch():
  3.     while True:
  4.         launcherchoice = input("Type L to login, or C to create a new account: ")
  5.         if launcherchoice == "L":
  6.             login()
  7.         if launcherchoice == "C":
  8.             newaccount()
  9. #define create account
  10. def newaccount():
  11.     while True:
  12.         global user, password
  13.         user = input('Please create a username for yourself. It must be a minimum of 4 characters long: ')
  14.         if len(user) >= 4:
  15.             break
  16.         else:
  17.             print('Your user name must be at least 4 characters long. Please choose a different username')
  18.     while True:
  19.         password = input('Please enter a password. It must be at least 5 characters long: ')
  20.         if len(password) >= 5:
  21.             break
  22.         else:
  23.             print('Your password must be at least 5 characters long. Please choose a different password')
  24.     while True:
  25.         if input("Please re-enter your password: ") == password:
  26.             print ("Thank you {}. Your account has been created" .format(user))
  27.             break
  28.         else:
  29.             print ("Your passwords do not match")
  30. #define login
  31. def login():
  32.     timeout = 0
  33.     while True:
  34.         import sys
  35.         if timeout >= 3:
  36.             print("You have been locked out, due to too many failed attempts")
  37.             sys.exit()
  38.         auth1 = input('To log in, please enter your previously created username: ')
  39.         auth2 = input('Please enter the account password: ')
  40.         if auth1 == user and auth2 == password:
  41.             print('Thank you {}. You have successfully logged in.'.format(user))
  42.             homescreen()
  43.         else:
  44.             timeout += 1
  45.             print('Whoops, something has gone wrong. Please re-enter the correct user name and password')
  46.             continue
  47. def homescreen():
  48.     import sys
  49.     while True:
  50.         print ("Welcome to the Homescreen")
  51.         sys.exit()
  52. launch()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement