Advertisement
Guest User

Untitled

a guest
Mar 19th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. --
  2. -- Variables
  3. --
  4. function handleError (errorMsg)
  5. term.clear()
  6. term.setCursorPos(1,1)
  7. errorMsg = errorMsg or "Unknown error occurred, rebooting..."
  8. print(errorMsg)
  9. sleep(5)
  10. os.reboot()
  11. end
  12.  
  13. --
  14. -- Interface
  15. --
  16. -- Interface Init.
  17. term.clear()
  18. term.setCursor(1,1)
  19.  
  20. -- Check Name
  21. print("Account Name:")
  22. local user = read()
  23.  
  24. print("Account Password:")
  25. local userPassword = read()
  26.  
  27. --
  28. -- Password Check
  29. --
  30. if fs.exists("accounts/"..user) == true then
  31. local file = fs.open("accounts/"..user.."accountInfo","r") -- open in read mode
  32. local accountPassword = file:read "*a" -- assign account's password to content
  33. file.close() -- always close or corruption can happen!
  34. if accountPassword == userPassword then
  35. print("Account Open!") -- test code
  36. sleep(5)
  37. os.reboot()
  38. -- Shell.openTab(WHATEVER UR ACCOUNT PROGRAM IS AND ITS ARGUMENTS)
  39. elseif accountPassword ~= userPassword then
  40. handleError("Error: Password Incorrect")
  41. end
  42. elseif fs.exists("accounts/"..user) == false then
  43. handleError("Error: Account doesn't exist")
  44. end
  45. handleError()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement