Require a browser fingerprint if requested (do not fail gracefully)

This commit is contained in:
RunasSudo 2018-03-26 21:36:14 +11:00
parent b6c0170748
commit ca084d3207
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
2 changed files with 12 additions and 9 deletions

View File

@ -48,16 +48,11 @@
// String.prototype.join confuses fingerprintjs2 // String.prototype.join confuses fingerprintjs2
var strjoin = String.prototype.join; var strjoin = String.prototype.join;
String.prototype.join = undefined; String.prototype.join = undefined;
try { new Fingerprint2().get(function(result, components) {
new Fingerprint2().get(function(result, components) { String.prototype.join = strjoin;
String.prototype.join = strjoin; booth.fingerprint = components;
booth.fingerprint = components;
nextTemplate();
});
} catch (ex) {
console.error(ex);
nextTemplate(); nextTemplate();
} });
} else { } else {
nextTemplate(); nextTemplate();
} }

View File

@ -67,6 +67,14 @@
resetBooth(); resetBooth();
function loadElection() { 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" }) $.ajax({ url: "{{ url_for('election_api_json', election_id=election._id) }}", dataType: "text" })
.done(function(data) { .done(function(data) {
try { try {