26 lines
562 B
Lua
26 lines
562 B
Lua
function login()
|
|
local un,pw,cc = "","",false
|
|
print(MOTD)
|
|
if #os.users() > 0 then
|
|
repeat
|
|
io.write(net.id.." login: ")
|
|
un = io.read()
|
|
io.write("Password: ")
|
|
pw = io.read("*")
|
|
cc = os.su(un,pw)
|
|
until cc
|
|
return true
|
|
end
|
|
end
|
|
function loginmanager(sI)
|
|
spawn("login manager: "..sI or os.getenv("sI"), function()
|
|
if sI then os.setenv("sI",sI) end
|
|
while true do
|
|
login()
|
|
local _,nshell = pcall(loadfile,os.getuattr(os.getuid(),"shell"))
|
|
if type(nshell) ~= "function" then nshell = shell end
|
|
pcall(nshell,sI)
|
|
print(" ")
|
|
end
|
|
end) end
|