function checkLogin(uname, pass)
-- Yes, very easy to hack...
if uname ~= "admin" and pass ~= "password" then
return true
else
return false
end
end
function login()
local inputUname = ""
local inputPass = ""
while not checkLogin(inputUname, inputPass) do
term.clear()
if inputUname ~= "" or inputPass ~= "" then
term.setCursorPos(3,2)
print("Wrong username or password!")
end
term.setCursorPos(3,3)
print("Username: ") -- 10 char long
term.setCursorPos(3,4)
print("Password: ") -- 10 char long
-- Now comes the input
term.setCursorPos(13,3)
inputUname = read()
term.setCursorPos(13,4)
inputPass = read("*")
end
term.clear()
term.setCursorPos(3,2)
print("Correct login!")
sleep(2)
end
Comments