Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide passphrase and private key at first. #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,11 @@
<div class="form-group">
<label class="col-lg-2 control-label" for="pass">Passphrase</label>
<div class="col-lg-10 controls">
<div class="input-append">
<input class="form-control" id="pass" placeholder="Long sentence that does not appear in songs or literature. SHA256 used as private key. Should not be empty!" type="text" autofocus/>
<div class="input-group">
<input class="form-control" id="pass" placeholder="Long sentence that does not appear in songs or literature. SHA256 used as private key. Should not be empty!" type="password" autofocus/>
<span class="input-group-btn">
<button id="togglePass" class="btn btn-info" type="button">Toggle</button>
</span>
</div>
</div>
</div>
Expand All @@ -129,7 +132,7 @@
</div>
</div>
</div>
<div class="form-group">
<div class="form-group" style="display:none">
<label class="col-lg-2 control-label" for="sec">Private Key</label>
<div class="col-lg-10 controls">
<input class="form-control" id="sec" readonly="readonly" spellcheck="false" title="Wallet Import Format (Base58Check of Secret Exponent)" type="text" />
Expand All @@ -143,8 +146,12 @@
</div>
<div class="form-group">
<label class="col-lg-2 control-label" for="genAddrQR">Address QR Code</label>
<div class="col-lg-10 controls">
<div class="col-lg-4 controls">
<a href="#" id="genAddrURL" target="_blank" title="Click to view address history (external link)"><span id="genAddrQR"></span></a>
<span id='toggleKeyCode' class='btn btn-default'>Toggle Key</span>
</div>
<div class="col-lg-3 controls">
<span id="genKeyQR" style="display:none"></span>
</div>
</div>
<div class="form-group">
Expand Down
25 changes: 25 additions & 0 deletions js/brainwallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,21 @@
$('#genAddrQR').html(qrCode.createImgTag(4));
$('#genAddrURL').attr('href', getAddressURL(addr));
$('#genAddrURL').attr('title', addr);

var keyQRCode = qrcode(3, 'L');
var text = $('#sec').val();
text = text.replace(/^[\s\u3000]+|[\s\u3000]+$/g, '');
keyQRCode.addData(text);
keyQRCode.make();

$('#genKeyQR').html(keyQRCode.createImgTag(4));
// NMC fix
if (ADDRESS_URL_PREFIX.indexOf('explorer.dot-bit.org')>=0 )
$('#genAddrURL').attr('href', ADDRESS_URL_PREFIX+'/a/'+addr);

// chainbrowser fix (needs closing slash for some reason)
if (ADDRESS_URL_PREFIX.indexOf('chainbrowser.com')>=0 )
$('#genAddrURL').attr('href', ADDRESS_URL_PREFIX+'/address/'+addr+'/');
}

function genCalcHash() {
Expand Down Expand Up @@ -1721,5 +1736,15 @@
console.log ('secureRandom is not supported');
}

$('#toggleKeyCode').on('click', function() {
$('#genKeyQR').slideToggle();
$('#sec').closest('.form-group').slideToggle();
});

$('#togglePass').on('click', function(){
var type = $('#pass').attr('type');
type = (type === 'text' ? 'password' : 'text');
$('#pass').attr('type', type);
});
});
})(jQuery);