Fix issues

This commit is contained in:
juhnsa committed 2025-08-27 13:27:36 +02:00
1 parent dca01a4116
commit 1ad962d223
1 file changed
+4 -7
+4 -7
View File
@@ -31,24 +31,21 @@ end
local function validate_key(card_holder, card_clearance, random_chars) local function validate_key(card_holder, card_clearance, random_chars)
local card_hash = hash(card_holder..','..card_clearance..','..random_chars) local card_hash = hash(card_holder..','..card_clearance..','..random_chars)
local key_file = fs.open(dir..config.key_file, 'r') local key_file = fs.open(dir..config.key_file, 'r')
local card_authentic = false
while true do while true do
local trusted_hash = key_file.readLine() local trusted_hash = key_file.readLine()
if trusted_hash == card_hash then if trusted_hash == card_hash then
print("Valid card "..card_hash) print("Valid card "..card_hash)
card_authentic = true key_file.close()
return true, card_hash return true, card_hash
end end
if not line then break end -- Stop when EOF reached if not trusted_hash then break end -- Stop when EOF reached
end end
key_file.close() key_file.close()
if card_authentic == false then print("Unknown card "..card_hash)
print("Unknown card "..card_hash) return false
return false
end
end end
if args[1] == "serve" then if args[1] == "serve" then