Prevents hosts from accidentally clicking the pairing links

This commit is contained in:
Maël Nison 2015-12-12 15:57:44 +01:00
parent 7f34b711a5
commit 803c7d4b4d

View file

@ -271,6 +271,9 @@
var pairingQueryString = '?name=' + encodeURIComponent( name ) + '&key=' + key + '&pairing=' + encryptedPairing; var pairingQueryString = '?name=' + encodeURIComponent( name ) + '&key=' + key + '&pairing=' + encryptedPairing;
tdName.innerText = name; tdName.innerText = name;
link.addEventListener( 'click', protect );
link.setAttribute( 'data-name', name );
link.href = window.location.protocol + '//' + window.location.host + pairingPath + pairingQueryString; link.href = window.location.protocol + '//' + window.location.host + pairingPath + pairingQueryString;
link.innerText = link.href; link.innerText = link.href;
@ -336,6 +339,16 @@
} }
function protect( e ) {
var name = e.currentTarget.getAttribute( 'data-name' );
if ( ! confirm( 'If you click this link, you will be revealed ' + name + '\'s pairing! Are you sure you want to do this? Only do this if you\'re actually ' + name + '.\n\nUse right-click to copy the link target instead.' ) ) {
e.preventDefault();
}
}
</script> </script>
<script> <script>