Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f = loadfile("/window.lib(copy)")
- if f == nil then
- print("error: window.lib is required please download it an set it at the path '/window.lib(copy)'")
- os.exit()
- end
- win = f()
- term = require("term")
- computer = require("computer")
- term.clear()
- f = {}
- function loadpass(mode, val)
- if mode == "write" then
- local d = io.open("/.pass.info", "w")
- d: write(val)
- d: close()
- elseif mode == "read" then
- local d = io.open("/.pass.info", "r")
- if d == nil then
- t = nil
- else
- t = d: read(require("filesystem").size("/.pass.info"))
- d: close()
- end
- return t
- else
- error("the mode: '"..mode.."' don't exists")
- end
- end
- _test = loadpass("read")
- print(_test) io.read()
- if _test == nil then
- print(win.load(w.np))
- io.read()
- end
- function f.npf(ts)
- loadpass("write", ts[1])
- computer.shutdown()
- end
- function f.mf(ts)
- term.clear()
- if ts[1] == loadpass("read") then
- --error("pass word true")
- d = io.open("/.open.info", "w")
- d: write("true")
- d: close()
- computer.shutdown(true)
- else
- win.load(wi.nt)
- end
- end
- wi = {}
- wi.np = {set={x = "center", y = "center"}, code = {{"centerText","please write a new pass word"}, {"space"}, {"input"}, {"space"}, {"button", "click her to safe and reboot", f.npf}}}
- wi.m = {set={x = "center", y = "center"}, code = {{"centerText","please write the password"}, {"space"}, {"input"}, {"space"}, {"button", "click her to login", f.mf}}}
- wi.nt = {set={x = "center", y = "center",w = 27, h = 6}, code = {{"centerText","the pass word is wrong!"}, {"space"}, {"button", "OK", computer.shutdown}}}
- function main()
- d,_ = io.open("/.pass.info")
- term.clear()
- if d == nil then
- win.load(wi.np)
- else
- win.load(wi.m)
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement