improve error msg - warning if has passphrase - hide QR data scanned (lock icon)

This commit is contained in:
Javier 2016-06-29 12:24:31 -03:00
commit 51bee061b1
4 changed files with 27 additions and 8 deletions

View file

@ -46,13 +46,18 @@
<div class="row">
<div class="large-12 columns">
<form name="importForm12" ng-submit="importMnemonic(importForm12)" novalidate>
<label for="words">
<label for="words" class="m25r">
<span translate>Type the Recovery Phrase (usually 12 words)</span>:
</label>
<div class="qr-scanner-input">
<qr-scanner on-scan="processCode(data)"></qr-scanner>
</div>
<textarea class="form-control" name="words" ng-model="words" rows="2" autocapitalize="off" spellcheck="false"></textarea>
<div class="lock-fromQR" ng-show="fromQR">
<i class="fi-lock color-greeni"></i>
</div>
<textarea class="form-control" name="words" ng-model="words" rows="2" autocapitalize="off" spellcheck="false" ng-click="fromQR = null"></textarea>
<div class="m10t oh" ng-init="hideAdv=true">
<a class="button outline light-gray expand tiny p10i" ng-click="hideAdv=!hideAdv">

View file

@ -10,7 +10,6 @@ angular.module('copayApp.controllers').controller('exportController',
$scope.isCordova = platformInfo.isCordova;
$scope.isSafari = platformInfo.isSafari;
$scope.error = null;
console.log(fc.credentials);
$scope.init = function(state) {
$scope.QROpts = false;

View file

@ -8,11 +8,13 @@ angular.module('copayApp.controllers').controller('importController',
var reader = new FileReader();
var defaults = configService.getDefaults();
var errors = bwcService.getErrors();
var dataFromQR = null;
$scope.bwsurl = defaults.bws.url;
$scope.derivationPath = derivationPathHelper.default;
$scope.account = 1;
$scope.processingCode = null;
$scope.importErr = false;
$scope.fromQR = null;
var updateSeedSourceSelect = function() {
$scope.seedOptions = [];
@ -34,6 +36,7 @@ angular.module('copayApp.controllers').controller('importController',
};
$scope.processCode = function(code) {
$scope.fromQR = null;
$scope.importErr = false;
$scope.error = null;
ongoingProcess.set('processingCode', true);
@ -41,7 +44,7 @@ angular.module('copayApp.controllers').controller('importController',
if (parsedCode.length != 6) {
ongoingProcess.set('processingCode', false);
$log.debug('Missing parameters');
$scope.error = gettext('Cannot read the code properly. Missing parameters');
return;
}
@ -51,9 +54,12 @@ angular.module('copayApp.controllers').controller('importController',
network: parsedCode[2] == 't' ? 'testnet' : 'livenet',
account: parseInt(parsedCode[3]),
derivationStrategy: parsedCode[4],
mnemonicHasPassphrase: parsedCode[5]
hasPassphrase: parsedCode[5] == 'true' ? true : false
};
if (info.type == 1 && info.hasPassphrase)
$scope.error = gettext('Password required. Make sure to enter your password in advanced options');
var client = bwcService.getClient(null, null);
if (info.type == 1) {
@ -78,7 +84,6 @@ angular.module('copayApp.controllers').controller('importController',
});
}
$scope.words = info.data;
$scope.derivationPath = client.credentials.getBaseAddressDerivationPath();
if (client.credentials.network == 'testnet')
@ -88,6 +93,9 @@ angular.module('copayApp.controllers').controller('importController',
$timeout(function() {
ongoingProcess.set('processingCode', false);
$scope.fromQR = true;
$scope.words = null;
dataFromQR = info.data;
$rootScope.$apply();
}, 1);
};
@ -245,7 +253,6 @@ angular.module('copayApp.controllers').controller('importController',
if ($scope.bwsurl)
opts.bwsurl = $scope.bwsurl;
var pathData = derivationPathHelper.parse($scope.derivationPath);
if (!pathData) {
$scope.error = gettext('Invalid derivation path');
@ -255,7 +262,7 @@ angular.module('copayApp.controllers').controller('importController',
opts.networkName = pathData.networkName;
opts.derivationStrategy = pathData.derivationStrategy;
var words = form.words.$modelValue;
var words = form.words.$modelValue || dataFromQR;
$scope.error = null;
if (!words) {

View file

@ -606,6 +606,10 @@ ul.manage li {
margin-right: 10px;
}
.m25r {
margin-right: 25px;
}
.m10l {
margin-left: 10px;
}
@ -869,6 +873,10 @@ ul.manage li {
background-color: #1ABC9C;
}
.lock-fromQR {
margin: 15px 0px -40px 5px;
}
.tx-proposal i {
padding: .1rem .3rem;
background-color: #A5B2BF;