diff --git a/lib/auth.lua b/lib/auth.lua index 4ea0b63..1ad898d 100644 --- a/lib/auth.lua +++ b/lib/auth.lua @@ -102,20 +102,20 @@ function add_user_to_group(username, group) if id == auth_server_id then if msg == "invalid request" then io.write("Invalid request\n") - return + return false elseif msg == "user not found" then io.write("User not found\n") - return + return false elseif msg == "invalid token" then io.write("Invalid token\n") - return + return false elseif msg == "invalid privileges" then io.write("Invalid privileges\n") - return + return false elseif msg == "ok" then - return + return true else - return + return false end end end diff --git a/packages/auth_server.lua b/packages/auth_server.lua index 89cae8c..5d118ba 100644 --- a/packages/auth_server.lua +++ b/packages/auth_server.lua @@ -199,7 +199,7 @@ while true do if not found then rednet.send(client_id, "invalid token", "auth") - elseif data.users[acting_user].groups["admin"] == nil then + elseif data.users[acting_user]["groups"] ~= nil or data.users[acting_user].groups["admin"] == nil then rednet.send(client_id, "invalid privileges", "auth") else if data.users[request.username].groups == nil then