aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Coleman <ian@iancoleman.io>2019-11-11 11:04:23 +1100
committerIan Coleman <ian@iancoleman.io>2019-11-11 11:04:23 +1100
commitea2cb91a49d57ee72674223eb3672fcb9a41130c (patch)
treeba8e88aa332e32877de52b2d1b264eeb2fdeb2fb
parentbfe1963eaaaba4441c6ba6e829e0d89262b819ac (diff)
downloadBIP39-ea2cb91a49d57ee72674223eb3672fcb9a41130c.tar.gz
BIP39-ea2cb91a49d57ee72674223eb3672fcb9a41130c.tar.zst
BIP39-ea2cb91a49d57ee72674223eb3672fcb9a41130c.zip
Tidy up split phrase warning
Make red only when danger is present Align neatly with the rest of the UI Increase size of text area to show all three rows, although it still overflows on 24 words.
-rw-r--r--src/css/app.css4
-rw-r--r--src/index.html6
-rw-r--r--src/js/index.js9
3 files changed, 13 insertions, 6 deletions
diff --git a/src/css/app.css b/src/css/app.css
index c2a0294..576b7d7 100644
--- a/src/css/app.css
+++ b/src/css/app.css
@@ -31,10 +31,6 @@ body {
31.phrase { 31.phrase {
32 word-break: keep-all; 32 word-break: keep-all;
33} 33}
34.phraseSplitWarn {
35 text-align: right;
36 color: red;
37}
38.generate-container .strength { 34.generate-container .strength {
39 /* override mobile width from bootstrap */ 35 /* override mobile width from bootstrap */
40 width: auto!important; 36 width: auto!important;
diff --git a/src/index.html b/src/index.html
index 096274d..ab1239a 100644
--- a/src/index.html
+++ b/src/index.html
@@ -175,9 +175,11 @@
175 <div class="form-group"> 175 <div class="form-group">
176 <label for="phrase" class="col-sm-2 control-label">BIP39 Split Mnemonic</label> 176 <label for="phrase" class="col-sm-2 control-label">BIP39 Split Mnemonic</label>
177 <div class="col-sm-10"> 177 <div class="col-sm-10">
178 <textarea id="phraseSplit" class="phraseSplit private-data form-control" title="Only 2 of 3 cards needed to recover."></textarea> 178 <textarea id="phraseSplit" class="phraseSplit private-data form-control" title="Only 2 of 3 cards needed to recover." rows="3"></textarea>
179 <p class="help-block">
180 <span id="phraseSplitWarn" class="phraseSplitWarn"></span>
181 </p>
179 </div> 182 </div>
180 <div id="phraseSplitWarn" class="phraseSplitWarn"></div>
181 </div> 183 </div>
182 <div class="form-group"> 184 <div class="form-group">
183 <label for="passphrase" class="col-sm-2 control-label">BIP39 Passphrase (optional)</label> 185 <label for="passphrase" class="col-sm-2 control-label">BIP39 Passphrase (optional)</label>
diff --git a/src/js/index.js b/src/js/index.js
index 03a8296..807230b 100644
--- a/src/js/index.js
+++ b/src/js/index.js
@@ -1470,16 +1470,25 @@
1470 DOM.splitPhrase.val(cards.join("\r\n")); 1470 DOM.splitPhrase.val(cards.join("\r\n"));
1471 var triesPerSecond=10000000000; 1471 var triesPerSecond=10000000000;
1472 var hackTime=Math.pow(2,wordCount*10/3)/triesPerSecond; 1472 var hackTime=Math.pow(2,wordCount*10/3)/triesPerSecond;
1473 var displayRedText = false;
1473 if (hackTime<1) { 1474 if (hackTime<1) {
1474 hackTime="<1 second"; 1475 hackTime="<1 second";
1476 displayRedText = true;
1475 } else if (hackTime<86400) { 1477 } else if (hackTime<86400) {
1476 hackTime=Math.floor(hackTime)+" seconds"; 1478 hackTime=Math.floor(hackTime)+" seconds";
1479 displayRedText = true;
1477 } else if(hackTime<31557600) { 1480 } else if(hackTime<31557600) {
1478 hackTime=Math.floor(hackTime/86400)+" days"; 1481 hackTime=Math.floor(hackTime/86400)+" days";
1482 displayRedText = true;
1479 } else { 1483 } else {
1480 hackTime=Math.floor(hackTime/31557600)+" years"; 1484 hackTime=Math.floor(hackTime/31557600)+" years";
1481 } 1485 }
1482 DOM.phraseSplitWarn.html("Time to hack with only one card: "+hackTime); 1486 DOM.phraseSplitWarn.html("Time to hack with only one card: "+hackTime);
1487 if (displayRedText) {
1488 DOM.phraseSplitWarn.addClass("text-danger");
1489 } else {
1490 DOM.phraseSplitWarn.removeClass("text-danger");
1491 }
1483 } 1492 }
1484 1493
1485 function isUsingOwnEntropy() { 1494 function isUsingOwnEntropy() {