pin panel shouldn't come up on authorized connections
This commit is contained in:
53
startup.lua
53
startup.lua
@ -177,29 +177,46 @@ local function MonitorRemoteIris()
|
|||||||
utils.log("ALERT: Remote iris moving: " .. remoteIrisState .. "%")
|
utils.log("ALERT: Remote iris moving: " .. remoteIrisState .. "%")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- If remote has computer and iris just became fully closed, offer password entry
|
-- If remote has computer and iris just became fully closed, wait for password request
|
||||||
if state.remoteHasComputer and remoteIrisState == 100 and (not lastIrisState or lastIrisState < 100) then
|
if state.remoteHasComputer and remoteIrisState == 100 and (not lastIrisState or lastIrisState < 100) then
|
||||||
utils.log("Remote iris closed but computer detected - showing password prompt")
|
utils.log("Remote iris closed and computer detected - waiting for password request")
|
||||||
|
|
||||||
local password = HandlePasswordEntry()
|
-- Wait briefly for password request message
|
||||||
|
local function WaitForPasswordRequest()
|
||||||
-- Wait for response
|
sleep(2) -- Wait up to 2 seconds for password request
|
||||||
local function WaitForResponse()
|
|
||||||
sleep(3) -- Wait up to 3 seconds for response
|
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local result = parallel.waitForAny(GetMessage, WaitForResponse)
|
local result = parallel.waitForAny(GetMessage, WaitForPasswordRequest)
|
||||||
if result == 1 then
|
if result == 1 then
|
||||||
local response = state.lastReceivedMessage
|
local message = state.lastReceivedMessage
|
||||||
state.lastReceivedMessage = nil
|
state.lastReceivedMessage = nil
|
||||||
if response == "IRIS_OPEN" then
|
|
||||||
display.showPasswordResult(true)
|
-- Only show password panel if explicitly requested
|
||||||
utils.log("Password accepted - iris opened")
|
if message == "IRIS_PASSWORD_REQUIRED" then
|
||||||
-- Continue monitoring, iris state will update
|
utils.log("Password requested by remote gate - showing password prompt")
|
||||||
elseif response == "IRIS_DENIED" then
|
|
||||||
display.showPasswordResult(false)
|
local password = HandlePasswordEntry()
|
||||||
utils.log("Password rejected")
|
|
||||||
|
-- Wait for response
|
||||||
|
local function WaitForResponse()
|
||||||
|
sleep(3) -- Wait up to 3 seconds for response
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
result = parallel.waitForAny(GetMessage, WaitForResponse)
|
||||||
|
if result == 1 then
|
||||||
|
local response = state.lastReceivedMessage
|
||||||
|
state.lastReceivedMessage = nil
|
||||||
|
if response == "IRIS_OPEN" then
|
||||||
|
display.showPasswordResult(true)
|
||||||
|
utils.log("Password accepted - iris opened")
|
||||||
|
-- Continue monitoring, iris state will update
|
||||||
|
elseif response == "IRIS_DENIED" then
|
||||||
|
display.showPasswordResult(false)
|
||||||
|
utils.log("Password rejected")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -313,6 +330,10 @@ local function handleIncomingWormhole()
|
|||||||
utils.openIris()
|
utils.openIris()
|
||||||
else
|
else
|
||||||
utils.closeIris()
|
utils.closeIris()
|
||||||
|
-- Send password request if iris is closed and password system is enabled
|
||||||
|
if config.irisPassword and config.enableMessaging then
|
||||||
|
utils.sendPasswordRequest()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -173,4 +173,13 @@ function utils.sendPasswordAttempt(password)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function utils.sendPasswordRequest()
|
||||||
|
if config.enableMessaging then
|
||||||
|
gate.sendStargateMessage("IRIS_PASSWORD_REQUIRED")
|
||||||
|
utils.log("Sent password request")
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
return utils
|
return utils
|
||||||
|
|||||||
Reference in New Issue
Block a user