Add visual privacy safeguard for private data

This commit is contained in:
Ian Coleman
2018-05-29 10:56:47 +10:00
parent 6f7fa3539e
commit 0b6e351dce
3 changed files with 40 additions and 15 deletions
+13
View File
@@ -23,6 +23,7 @@
var generationProcesses = [];
var DOM = {};
DOM.privacyScreenToggle = $(".privacy-screen-toggle");
DOM.network = $(".network");
DOM.bip32Client = $("#bip32-client");
DOM.phraseNetwork = $("#network-phrase");
@@ -118,6 +119,7 @@
function init() {
// Events
DOM.privacyScreenToggle.on("change", privacyScreenToggled);
DOM.generatedStrength.on("change", generatedStrengthChanged);
DOM.network.on("change", networkChanged);
DOM.bip32Client.on("change", bip32ClientChanged);
@@ -447,6 +449,17 @@
$("td.privkey span").toggleClass("invisible");
}
function privacyScreenToggled() {
// private-data contains elements added to DOM at runtime
// so catch all by adding visual privacy class to the root of the DOM
if (DOM.privacyScreenToggle.prop("checked")) {
$("body").addClass("visual-privacy");
}
else {
$("body").removeClass("visual-privacy");
}
}
// Private methods
function generateRandomPhrase() {