Store and verify connection parameters

This commit is contained in:
jyio committed 2022-09-26 11:15:14 -04:00
1 parent 5035ff2dd1
commit 31ffadbae3
3 files changed
+14 -8

No files matched your search

+5 -1
View File
@@ -159,7 +159,11 @@ Client.fromCookie = async function(secret, host='vista.northport.med.va.gov', po
console.log('Using saved secret and connection', secret);
var cid = cookie.get('cid');
var client = Client.fromID(cid, secret);
if((await vista.call(cid, 'XWB_IM_HERE')).result == '1') return client;
if((await vista.call(cid, 'XWB_IM_HERE')).result == '1') {
var server = await client.serverinfo();
if((host == server.result.host) && (port == server.result.port)) return client;
else console.log('Rejecting previous connection to different server', server);
}
cookie.reset('cid');
return await Client.fromCookie(secret, host, port);
}