Added security key stuff

This commit is contained in:
Andrew Lalis 2023-08-29 15:45:16 -04:00
parent 84f99fd35d
commit 26ca5a7093
1 changed files with 6 additions and 2 deletions

View File

@ -263,8 +263,12 @@ local function authProtect(func, secure)
) then
return {success = false, error = "Invalid credentials"}
end
if secure and (not msg.auth.key or msg.auth.key ~= SECURITY_KEY) then
if secure then
if not msg.auth.key then
return {success = false, error = "Missing security key"}
elseif msg.auth.key ~= SECURITY_KEY then
return {success = false, error = "Invalid security key"}
end
end
return func(msg)
end