Guest User

Untitled

a guest
Oct 6th, 2018
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.27 KB | None | 0 0
  1. --Jazza_Hat
  2. userNames = {}
  3.  
  4. local function clear()
  5.     term.clear()
  6.     term.setCursorPos(1,1)
  7. end
  8.  
  9. local function draw(err)
  10.         if err == true then
  11.             print(err)
  12.             sleep(2)
  13.         end
  14.     clear()
  15.     print("Hello and welcome!")
  16.     print("1.Create account")
  17.     print("2.Login")
  18.     local event, param1 = os.pullEvent ("char")
  19.         if param1 == "1" then
  20.                 write("Please enter your Username: ")
  21.                 local username = read()
  22.                 write("Please enter password: ")
  23.                 local password = read("*")
  24.                 local sha1User = StrUtils.SHA1(username)
  25.                 local sha1Pass = StrUtils.SHA1(password)
  26.                     if userNames[sha1User] == true then
  27.                             draw("Invalid username and, or Password")
  28.                     end
  29.                 userNames[sha1User] = sha1Pass
  30.                 print("Thank you for creating an account, press any key to continue")
  31.                 local event, param1 = os.pullEvent ("char")
  32.                     draw()
  33.         elseif param1 == "2" then
  34.                 write("Please enter your Username: ")
  35.                 local username = read()
  36.                 write("Please enter password: ")
  37.                 local password = read("*")
  38.                 local sha1User = StrUtils.SHA1(username)
  39.                 local sha1Pass = StrUtils.SHA1(password)
  40.                     if userNames[sha1User] == sha1Pass then
  41.                         draw("Hello")
  42.                     end
  43.                 draw("Invalid username and, or Password")
  44.         else
  45.                 draw("Unknown function")
  46.         end
  47. end
  48.  
  49. draw()
Add Comment
Please, Sign In to add comment