Fix to QuickConnect

This commit is contained in:
Jimi 2024-01-13 10:00:29 -07:00 committed by Charles Ewert
parent 5db1b48f96
commit 6c9b3f10b5
3 changed files with 18 additions and 17 deletions

View File

@ -10,8 +10,16 @@ sub monitorQuickConnect()
authenticated = checkQuickConnect(m.top.secret)
if authenticated = true
loggedIn = AuthenticateViaQuickConnect(m.top.secret)
if loggedIn
currentUser = AboutMe()
session.user.Login(currentUser, m.top.saveCredentials)
session.user.LoadUserPreferences()
LoadUserAbilities()
m.top.authenticated = 1
else
m.top.authenticated = -1
return
end if
end if
m.top.authenticated = -1
end sub

View File

@ -4,5 +4,6 @@
<interface>
<field id="secret" type="string" />
<field id="authenticated" type="integer" value="0" />
<field id="saveCredentials" type="boolean" />
</interface>
</component>

View File

@ -14,11 +14,13 @@ sub quickConnectStatus()
m.quickConnectTimer.control = "stop"
m.checkTask = CreateObject("roSGNode", "QuickConnect")
m.checkTask.secret = m.top.quickConnectJson.secret
m.checkTask.saveCredentials = m.top.saveCredentials
m.checkTask.observeField("authenticated", "OnAuthenticated")
m.checkTask.control = "run"
end sub
sub OnAuthenticated()
m.checkTask.control = "stop"
m.checkTask.unobserveField("authenticated")
' Did we get the A-OK to authenticate?
@ -26,28 +28,18 @@ sub OnAuthenticated()
if authenticated < 0
' Still waiting, check again in 3 seconds...
authenticated = 0
m.checkTask.observeField("authenticated", "OnAuthenticated")
m.quickConnectTimer.control = "start"
else if authenticated > 0
' We've been given the go ahead, try to authenticate via Quick Connect...
authenticated = AuthenticateViaQuickConnect(m.top.quickConnectJson.secret)
if authenticated <> invalid and authenticated = true
currentUser = AboutMe()
session.user.Login(currentUser, m.top.saveCredentials)
session.user.LoadUserPreferences()
LoadUserAbilities()
' We've been logged in via Quick Connect...
m.top.close = true
m.top.authenticated = true
else
m.top.close = true
m.top.authenticated = false
end if
end if
end sub
sub quickConnectClosed()
m.quickConnectTimer.control = "stop"
if m.checkTask <> invalid
m.checkTask.control = "stop"
m.checkTask.unobserveField("authenticated")
end if
m.top.close = true