From ca084d320797edfbd5a45adb06dcca11d6ef002a Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Mon, 26 Mar 2018 21:36:14 +1100 Subject: [PATCH] Require a browser fingerprint if requested (do not fail gracefully) --- eosweb/core/static/nunjucks/booth/encrypt.html | 13 ++++--------- eosweb/core/templates/election/view/booth.html | 8 ++++++++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/eosweb/core/static/nunjucks/booth/encrypt.html b/eosweb/core/static/nunjucks/booth/encrypt.html index 027b3df..bb5421d 100644 --- a/eosweb/core/static/nunjucks/booth/encrypt.html +++ b/eosweb/core/static/nunjucks/booth/encrypt.html @@ -48,16 +48,11 @@ // String.prototype.join confuses fingerprintjs2 var strjoin = String.prototype.join; String.prototype.join = undefined; - try { - new Fingerprint2().get(function(result, components) { - String.prototype.join = strjoin; - booth.fingerprint = components; - nextTemplate(); - }); - } catch (ex) { - console.error(ex); + new Fingerprint2().get(function(result, components) { + String.prototype.join = strjoin; + booth.fingerprint = components; nextTemplate(); - } + }); } else { nextTemplate(); } diff --git a/eosweb/core/templates/election/view/booth.html b/eosweb/core/templates/election/view/booth.html index 0ac4c9f..bc94928 100644 --- a/eosweb/core/templates/election/view/booth.html +++ b/eosweb/core/templates/election/view/booth.html @@ -67,6 +67,14 @@ resetBooth(); function loadElection() { + // Verify booth + if (should_do_fingerprint) { + if (typeof Fingerprint2 === 'undefined') { + boothError('Your browser did not load fingerprintj2 correctly. Please try again after disabling your ad blockers and similar software. If the issue persists, try using a different browser.'); + return; + } + } + $.ajax({ url: "{{ url_for('election_api_json', election_id=election._id) }}", dataType: "text" }) .done(function(data) { try {