Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Jazza_Hat
- userNames = {}
- local function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- local function draw(err)
- if err == true then
- print(err)
- sleep(2)
- end
- clear()
- print("Hello and welcome!")
- print("1.Create account")
- print("2.Login")
- local event, param1 = os.pullEvent ("char")
- if param1 == "1" then
- write("Please enter your Username: ")
- local username = read()
- write("Please enter password: ")
- local password = read("*")
- local sha1User = StrUtils.SHA1(username)
- local sha1Pass = StrUtils.SHA1(password)
- if userNames[sha1User] == true then
- draw("Invalid username and, or Password")
- end
- userNames[sha1User] = sha1Pass
- print("Thank you for creating an account, press any key to continue")
- local event, param1 = os.pullEvent ("char")
- draw()
- elseif param1 == "2" then
- write("Please enter your Username: ")
- local username = read()
- write("Please enter password: ")
- local password = read("*")
- local sha1User = StrUtils.SHA1(username)
- local sha1Pass = StrUtils.SHA1(password)
- if userNames[sha1User] == sha1Pass then
- draw("Hello")
- end
- draw("Invalid username and, or Password")
- else
- draw("Unknown function")
- end
- end
- draw()
Add Comment
Please, Sign In to add comment