hide passphrase if pk is not encrypted

This commit is contained in:
Javier 2015-10-07 15:32:52 -03:00
parent be30eb39c3
commit 19181a9462
2 changed files with 20 additions and 12 deletions

View File

@ -25,23 +25,25 @@
<div ng-show="!paperWallet.balance" class="row"> <div ng-show="!paperWallet.balance" class="row">
<div class="large-12 medium-12 columns"> <div class="large-12 medium-12 columns">
<div class="input"> <div class="input">
<label for="privateKey" translate>Paper Wallet Private Key</label> <label for="inputData" translate>Paper Wallet Private Key</label>
<input type="text" placeholder="{{'Paste your paper wallet private key here'|translate}}" ng-model="privateKey" id="privateKey"> <input type="text" placeholder="{{'Paste your paper wallet private key here'|translate}}" ng-model="inputData" id="inputData" ng-change="paperWallet.onData(inputData)">
<div class="qr-scanner-input"> <div class="qr-scanner-input">
<qr-scanner on-scan="paperWallet.onQrCodeScanned(data)"></qr-scanner> <qr-scanner on-scan="paperWallet.onQrCodeScanned(data)"></qr-scanner>
</div> </div>
<div ng-show="paperWallet.isPkEncrypted">
<label for="passphrase"> <label for="passphrase">
<span translate>Passphrase (if you have one)</span> <span translate>Passphrase</span>
</label> </label>
<input id="passphrase" type="password" name="passphrase" placeholder="{{'Passphrase'|translate}}" ng-model="passphrase"> <input id="passphrase" type="password" name="passphrase" placeholder="{{'Passphrase'|translate}}" ng-model="passphrase">
<p ng-show="index.isCordova" translate class="size-12 text-gray"> <p ng-show="index.isCordova" translate class="size-12 text-gray">
Decrypting a paper wallet could take around 5 minutes on this device. please be patient and keep the app open. Decrypting a paper wallet could take around 5 minutes on this device. please be patient and keep the app open.
</p> </p>
</div>
<button <button
ng-disabled="paperWallet.scanning || !privateKey" ng-disabled="paperWallet.scanning || !paperWallet.scannedKey"
ng-style="{'background-color':index.backgroundColor}" ng-style="{'background-color':index.backgroundColor}"
class="button black round expand" class="button black round expand"
ng-click="paperWallet.createTx(privateKey, passphrase)" ng-click="paperWallet.createTx(inputData, passphrase)"
translate>Scan Wallet Funds translate>Scan Wallet Funds
</button> </button>
</div> </div>

View File

@ -5,7 +5,13 @@ angular.module('copayApp.controllers').controller('paperWalletController',
var rawTx; var rawTx;
self.onQrCodeScanned = function(data) { self.onQrCodeScanned = function(data) {
$scope.privateKey = data; $scope.inputData = data;
self.onData(data);
}
self.onData = function(data) {
self.scannedKey = data;
self.isPkEncrypted = (data.charAt(0) == '6');
} }
self.createTx = function(privateKey, passphrase) { self.createTx = function(privateKey, passphrase) {