Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local App = app.new()
- App.EventHandler:disconnectAll("terminate")
- local timer = nil
- local c,b = "00000877", "ffffffff"
- if term.isColor() then c, b = "00000bde", "77777777" end
- local password, passwordDisplay = "", ""
- App.EventHandler:connect("char", function(char)
- password = password..char
- passwordDisplay = passwordDisplay.."*"
- end)
- App.EventHandler:connect("key_up", function(key)
- if key == keys.enter then
- if md5.calc(password) ~= _G.User.Password then
- term.setCursorPos(1,4)
- print("Incorrect Password.")
- sleep(1)
- password = ""
- passwordDisplay = ""
- return
- end
- App:stop()
- elseif key == keys.backspace then
- password = string.sub(password,1,-2)
- passwordDisplay = string.sub(passwordDisplay,1,-2)
- end
- end)
- App.EventHandler:connect("timer", function(completed)
- if completed ~= timer then return end
- shell.switchTab(1)
- timer = os.startTimer(1/30)
- end)
- App.EventHandler:connect("app_closed", function(app)
- apps = data.load("/.apps")
- local id = apps[app][3]
- for code,data in pairs(apps) do
- if data[3] and (not id or data[3] > id) then
- apps[code][3] = data[3] - 1
- end
- end
- if id then apps[app][3] = -1 end
- data.save("/.apps", apps)
- end)
- function App:draw()
- term.setTextColor(_G.TextColor)
- term.setBackgroundColor(_G.BackgroundColor)
- term.clear()
- term.setCursorPos(1,1)
- term.blit("nekOS///",c,b)
- term.write(" ".._G.User.Username)
- term.setCursorPos(1,2)
- term.write("Password> "..passwordDisplay)
- end
- function App:stopped()
- shell.run(".menu")
- end
- timer = os.startTimer(1/30)
- App:start()
Add Comment
Please, Sign In to add comment