Attempt to fix the password prompt #2

This commit is contained in:
2026-01-01 22:57:57 -05:00
parent ed517502e2
commit 86228fd047

View File

@ -263,44 +263,72 @@ 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, wait for password request -- If remote has computer and iris just became fully closed, check 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 and computer detected - waiting for password request") utils.log("Remote iris closed and computer detected - checking for password request")
-- Wait briefly for password request message -- Check if password was already requested during initial connection
local function WaitForPasswordRequest() if state.remotePasswordRequired then
sleep(2) -- Wait up to 2 seconds for password request utils.log("Password already requested - showing password prompt")
return nil
end
local result = parallel.waitForAny(GetMessage, WaitForPasswordRequest) local password = HandlePasswordEntry()
if result == 1 then
local message = state.lastReceivedMessage
state.lastReceivedMessage = nil
-- Only show password panel if explicitly requested -- Wait for response
if message == "IRIS_PASSWORD_REQUIRED" then local function WaitForResponse()
utils.log("Password requested by remote gate - showing password prompt") sleep(3) -- Wait up to 3 seconds for response
return nil
end
local password = HandlePasswordEntry() local result = parallel.waitForAny(GetMessage, WaitForResponse)
if result == 1 then
-- Wait for response local response = state.lastReceivedMessage
local function WaitForResponse() state.lastReceivedMessage = nil
sleep(3) -- Wait up to 3 seconds for response if response == "IRIS_OPEN" then
return nil 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
else
-- Wait briefly for password request message if not already received
utils.log("Waiting for password request message")
local function WaitForPasswordRequest()
sleep(2) -- Wait up to 2 seconds for password request
return nil
end
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 end
@ -707,7 +735,7 @@ local function handleOutgoingDial()
end end
print("DEBUG: Message collection complete. remoteHasComputer=" .. print("DEBUG: Message collection complete. remoteHasComputer=" ..
tostring(state.remoteHasComputer) .. ", remotePasswordRequired=" .. tostring(state.remotePasswordRequired)) tostring(state.remoteHasComputer) .. ", remotePasswordRequired=" .. tostring(state.remotePasswordRequired))
-- Check if remote iris is closed using transceiver -- Check if remote iris is closed using transceiver
local remoteIrisState = nil local remoteIrisState = nil