Posted 17 December 2012 - 07:26 AM
Well I've been working on this and I wanted to release it so I had a place to update. Next I'm adding a list for username and passwords so it's compatible with more than 1. Here you go though, it's very simple and easy to configure. I use it like so in my startup script at spawn:
That way if anyone tries to edit the code or display things on the monitor they need explicit access.
Here you go!
shell.run("rules")
shell.run("clear")
shell.run("root")
That way if anyone tries to edit the code or display things on the monitor they need explicit access.
Here you go!
Spoiler
os.pullEvent = os.pullEventRaw
term.clear()
x, y = term.getSize()
user = "remus"
pass = "remus"
function center(text, yp)
cx = math.ceil((x/2)-(string.len(text)/2))
term.setCursorPos(cx, yp)
write(text)
end
center("Welcome to CorpOS", 1)
center("Please login to the system.", 3)
center("", 5)
write("Username: ")
local username = read()
center("", 7)
write("Password: ")
local password = read("*")
if username == (user) and password == (pass) then
sleep(2)
center("Login accepted.", 9)
sleep(.7)
shell.run("clear")
else
sleep(2)
center("Access denied.", 9)
sleep(.7)
shell.run("root")
end