diff --git a/packages/lns_server.lua b/packages/lns_server.lua index 967098b..15d698e 100644 --- a/packages/lns_server.lua +++ b/packages/lns_server.lua @@ -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")