Advertisement
Siftos31

login

Feb 2nd, 2019
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.64 KB | None | 0 0
  1. --Information about the OS is stored here--
  2. version = 0.8
  3.  
  4. --Variables
  5. w, h = term.getSize()
  6.  
  7. ---Colors
  8. blue = colors.blue
  9. black = colors.black
  10. white = colors.white
  11. red = colors.red
  12. yellow = colors.yellow
  13. lightBlue = colors.lightBlue
  14. lightGray = colors.lightGray
  15. green = colors.green
  16. lime = colors.lime
  17. pink = colors.pink
  18. purple = colors.purple
  19. magenta = colors.magenta
  20. gray = colors.gray
  21. brow = colors.brown
  22. cyan = colors.cyan
  23. orange = colors.orange
  24.  
  25. --Functions
  26. function clear()
  27. term.clear()
  28. end
  29.  
  30. function setBackgroundColor(...)
  31. term.setBackgroundColor(...)
  32. term.clear()
  33. end
  34.  
  35. function clearLine(y, c)
  36. term.setCursorPos(1,y)
  37. term.setBackgroundColor(c)
  38. term.clearLine()
  39. end
  40.  
  41. function setTextcolor(...)
  42. term.setTextColor(...)
  43. end
  44.  
  45. function printCenter(y, s)
  46. local x = math.floor((w - string.len(s))/2)
  47. term.setCursorPos(x,y)
  48. write(s)
  49. end
  50.  
  51. function slowPrint(...)
  52. textutils.slowPrint(...)
  53. end
  54.  
  55. function slowWrite(...)
  56. textutils.slowWrite(...)
  57. end
  58.  
  59. function setCursorPos(x, y)
  60. term.setCursorPos(x,y)
  61. end
  62.  
  63. function background(...)
  64. term.setBackgroundColor(...)
  65. end
  66.  
  67. function drawImage(x,y,s)
  68. paintutils.drawImage(paintutils.loadImage(s),x,y)
  69. end
  70.  
  71.  
  72. oldPull = os.pullEvent;
  73. os.pullEvent = os.pullEventRaw;
  74.  
  75. setBackgroundColor(white)
  76. setCursorPos(1,1)
  77. setTextcolor(lightBlue)
  78. print("ACEOS X "..version)
  79. if fs.exists("privacy/password") and fs.exists("privacy/username") then
  80. local fl = fs.open("privacy/username","r")
  81. username = fl.readLine()
  82. fl.close()
  83. setTextcolor(blue)
  84. printCenter(7,username)
  85. setCursorPos(21,9)
  86. m = fs.open("/privacy/password","r")
  87. pass = tostring(m.readLine())
  88. m.close()
  89. a = read("*")
  90.   if a == pass then
  91.   setTextcolor(colors.lime)
  92.   printCenter(10,"Acces Granted")
  93.   sleep(0.3)
  94.   shell.run("/swfiles/ACEOS.lua")
  95.   else
  96.   setTextcolor(red)
  97.   printCenter(10,"Acces Denied")
  98.   sleep(0.5)
  99.   shell.run("swfiles/login.lua")
  100.   end
  101. elseif not fs.exists("/privacy/password") and not fs.exists("/privacy/username") then
  102. setBackgroundColor(black)
  103. setTextcolor(yellow)
  104. setCursorPos(1,1)
  105. print("Username: ")
  106. print("Password: ")
  107. setCursorPos(1,4)
  108. setTextcolor(lightBlue)
  109. print("No more than eight characters in the password")
  110. setTextcolor(white)
  111. setCursorPos(11,1)
  112. u = read()
  113. setCursorPos(11,2)
  114. p = tostring(read())
  115. if string.len(p) >= 9 then
  116. shell.run("swfiles/login.lua")
  117. else
  118. fs.copy("/privacy/file","/privacy/username")
  119. fs.copy("/privacy/file","/privacy/password")
  120. local c = fs.open("/privacy/username","w")
  121. c.writeLine(u)
  122. c.close()
  123. local h = fs.open("/privacy/password","w")
  124. h.writeLine(p)
  125. h.close()
  126. shell.run("/swfiles/login.lua")
  127. end
  128. end  
  129. os.pullEvent = oldPull;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement