Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- log(" ")
- log("-------------------------")
- log("Running login.lua")
- log("-------------------------")
- log(" ")
- function s(...) return sleep(...) end
- function w(...) return write(...) end
- function p(...) return print(...) end
- function tw(...) return term.write(...) end
- function scp(...) return term.setCursorPos(...) end
- function sbc(...) return term.setBackgroundColor(...) end
- function stc(...) return term.setTextColor(...) end
- function tc(...) return term.clear(...) end
- function tcl(...) return term.clearLine() end
- function scb(...) return term.setCursorBlink(...) end
- function ts(...) return term.scroll(...) end
- function r(...) return shell.run(...) end
- function para(...) return parallel.waitForAny(...) end
- function sw(...) return textutils.slowWrite(...) end
- function sp(...) return textutils.slowPrint(...) end
- log("==> Creating incorrect password window")
- wrong = window.create(term.current(),28,10,22,7)
- wrong.setVisible(false)
- log("==> Clearing screen")
- sbc(colors.cyan)
- term.clear()
- log("==> Loading User data")
- log("==> Loading and drawing computer image")
- computer = paintutils.loadImage("OS/computer.png")
- paintutils.drawImage(computer, 3, 3 )
- log("==> Adding content to incorrect password window")
- wrong.setBackgroundColor(colors.white)
- wrong.clear()
- wrong.setCursorPos(1,1)
- wrong.setBackgroundColor(colors.blue)
- wrong.write(" Wrong Information ")
- wrong.setCursorPos(1,3)
- wrong.setBackgroundColor(colors.white)
- wrong.setTextColor(colors.black)
- wrong.write(" Wrong password or")
- wrong.setCursorPos(1,4)
- wrong.write(" Username please try")
- wrong.setCursorPos(1,5)
- wrong.write(" again.")
- scp(28,4)
- sbc(colors.cyan)
- print("Login")
- while true do
- log("==> Creating username box")
- username = window.create(term.current(),28,6,23,1)
- username.setBackgroundColor(colors.white)
- username.clear()
- log("==> Creating password box")
- password = window.create(term.current(),28,8,23,1)
- password.setBackgroundColor(colors.white)
- password.clear()
- sbc(colors.white)
- stc(colors.black)
- scp(28,6)
- log("==> Allowing input for username")
- username = read()
- scp(28,8)
- stc(colors.black)
- sbc(colors.white)
- log("==> Allowing input for password")
- password = read("*")
- log("==> Recvied username and password")
- log("Checking if it matches any user data")
- checkUser()
- if username == UserInfo[1][1] and password == UserInfo[1][2] or username == UserInfo[2][1] and password == UserInfo[2][2] or username == UserInfo[3][1] and password == UserInfo[3][2] or username == UserInfo[4][1] and password == UserInfo[4][2] then
- log("==> Data found... Logging into user \""..username1.."\"")
- log("==> Checking permissions")
- CurrentUser = username
- if username == UserInfo[1][1] then
- admin = UserInfo[1][3]
- elseif username == UserInfo[2][1] then
- admin = UserInfo[2][3]
- elseif username == UserInfo[3][1] then
- admin = UserInfo[3][3]
- elseif username == UserInfo[4][1] then
- admin = UserInfo[4][3]
- end
- sbc(colors.cyan)
- term.clear()
- paintutils.drawImage(computer, 3, 3 )
- scp(25,7)
- sbc(colors.cyan)
- stc(colors.white)
- term.write("Loading Desktop")
- local i = 1
- log("==> Loading and displaying loading images")
- loadingicon = paintutils.loadImage("OS/loading.png")
- repeat
- paintutils.drawImage(loadingicon, 28, 9 )
- sleep(1)
- paintutils.drawImage(loadingicon, 32, 9 )
- sleep(1)
- paintutils.drawImage(loadingicon, 36, 9 )
- sleep(1)
- scp(1,9)
- sbc(colors.cyan)
- term.write(" ")
- i = i + 1
- paintutils.drawImage(computer, 3, 3 )
- until i == 2
- shell.run('OS/desktop.lua')
- log("ERROR ==> login.lua has been resumed, a app may of crashed. (NEAR LN108, OS/login.lua)")
- sbc(colors.cyan)
- term.clear()
- paintutils.drawImage(computer, 3, 3 )
- errormessage = window.create(term.current(),15,7,25,6)
- errormessage.setBackgroundColor(colors.white)
- errormessage.clear()
- errormessage.setCursorPos(1,1)
- errormessage.setBackgroundColor(colors.red)
- errormessage.write(" Error ")
- errormessage.setTextColor(colors.black)
- errormessage.setCursorPos(2,2)
- errormessage.setBackgroundColor(colors.white)
- errormessage.write("A error has occurred!")
- errormessage.setCursorPos(2,3)
- errormessage.write("Please check the log to")
- errormessage.setCursorPos(2,4)
- errormessage.write("find out more info.")
- errormessage.setCursorPos(10,5)
- errormessage.setBackgroundColor(colors.lightGray)
- errormessage.setTextColor(colors.white)
- errormessage.write(" Ok ")
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- if x >= 24 and x <= 27 and y == 11 then
- shell.run('OS/login.lua')
- end
- end
- else
- log("ERROR ==> Input we recived did not match any user data... Displaying error message to user")
- wrong.setVisible(true)
- end
- end
- sleep(2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement