Store and verify connection parameters

This commit is contained in:
2022-09-24 14:42:35 -04:00
parent 5035ff2dd1
commit 31ffadbae3
3 changed files with 14 additions and 8 deletions

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);
}