Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os.path
- def login():
- username = raw_input("Enter your username: ")
- hashes = open("hashes.txt", "r")
- check = hashes.readlines()
- passcheck = check[1]
- passcheck = passcheck.strip()
- def passcheckfunc():
- password = raw_input("Enter your password: ")
- password = hash(password)
- print passcheck
- print password
- if passcheck == password:
- print "You now have access to this computer!"
- else:
- print "Wrong password."
- passcheckfunc()
- def usercheckfunc():
- usercheck = check[0]
- usercheck = usercheck.strip()
- if username == usercheck:
- passcheckfunc()
- else:
- print "Username not found."
- login()
- usercheckfunc()
- def register():
- username = raw_input("Enter your username: ")
- password = raw_input("Enter your password: ")
- passhash = hash(password)
- hashes = open("hashes.txt", "w")
- hashes.write(username)
- passhash = str(passhash)
- hashes.write("\n" + passhash)
- print "You are now registered on this computer!"
- def processfunc():
- process = raw_input("What would you like to do? (Login or Register): ")
- process = process.lower()
- if process == 'login':
- login()
- elif process == 'register':
- register()
- else:
- print "That is not a process!"
- processfunc()
- processfunc()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement