iteration

This commit is contained in:
Layla 2023-10-08 05:43:24 -04:00
parent 8c3feb5233
commit cba8b4089c

View File

@ -83,6 +83,32 @@ function split (inputstr, sep)
return t
end
function check_user_in_group(username, group)
local data = {
["action"] = "check_group",
["username"] = username,
["group"] = group
}
local authID = data[auth_server]
rednet.send(authID, data, "auth")
while true do
id, msg = rednet.receive("auth")
if id == authID then
if msg == "invalid request" then
io.write("Invalid request\n")
return false
elseif msg == true then
return true
else
return false
end
end
end
end
load_data()
while true do
@ -133,7 +159,7 @@ while true do
if errorPos then
log("Error: " .. auth_response)
else
if auth.check_user_in_group(auth_response, auth_group) then
if check_user_in_group(auth_response, auth_group) then
auth_passed = true
else
rednet.send(client_id, "invalid auth", "lns")