Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define launcher
- def launch():
- while True:
- launcherchoice = input("Type L to login, or C to create a new account: ")
- if launcherchoice == "L":
- login()
- if launcherchoice == "C":
- newaccount()
- #define create account
- def newaccount():
- while True:
- global user, password
- user = input('Please create a username for yourself. It must be a minimum of 4 characters long: ')
- if len(user) >= 4:
- break
- else:
- print('Your user name must be at least 4 characters long. Please choose a different username')
- while True:
- password = input('Please enter a password. It must be at least 5 characters long: ')
- if len(password) >= 5:
- break
- else:
- print('Your password must be at least 5 characters long. Please choose a different password')
- while True:
- if input("Please re-enter your password: ") == password:
- print ("Thank you {}. Your account has been created" .format(user))
- break
- else:
- print ("Your passwords do not match")
- #define login
- def login():
- timeout = 0
- while True:
- import sys
- if timeout >= 3:
- print("You have been locked out, due to too many failed attempts")
- sys.exit()
- auth1 = input('To log in, please enter your previously created username: ')
- auth2 = input('Please enter the account password: ')
- if auth1 == user and auth2 == password:
- print('Thank you {}. You have successfully logged in.'.format(user))
- homescreen()
- else:
- timeout += 1
- print('Whoops, something has gone wrong. Please re-enter the correct user name and password')
- continue
- def homescreen():
- import sys
- while True:
- print ("Welcome to the Homescreen")
- sys.exit()
- launch()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement