From 255ab97677cd5330488801f943b2a3a856ede1bb Mon Sep 17 00:00:00 2001 From: "R. Aidan Campbell" Date: Fri, 11 Mar 2016 09:30:32 -0500 Subject: [PATCH] now with a random pairing number, instead of 1233 --- static/js/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/static/js/index.js b/static/js/index.js index fef0a87..8d5bef2 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -64,14 +64,15 @@ function pairPushed() { console.log("Attempting to pair to: " + target); sendMessage('httpInit', [pairingCert.cert, pairingCert.privateKey, myUniqueid]).then(function (ret) { console.log('httpInit function completed. it returned: ' + ret); + var randomNumber = String("0000" + (Math.random()*10000|0)).slice(-4); var pairingDialog = document.querySelector('#pairingDialog'); document.getElementById('pairingDialogText').innerHTML = - 'Please enter the number 1233 on the GFE dialog on the computer. This dialog will be dismissed once complete'; + 'Please enter the number ' + randomNumber + ' on the GFE dialog on the computer. This dialog will be dismissed once complete'; pairingDialog.showModal(); pairingDialog.querySelector('#CancelPairingDialog').addEventListener('click', function() { pairingDialog.close(); }); - sendMessage('pair', [target, "1233"]).then(function (ret2) { + sendMessage('pair', [target, randomNumber]).then(function (ret2) { if (ret2 === 0) { $('#pairButton')[0].innerHTML = 'Paired'; pairingDialog.close();