better error when importing a wrong mnemonic

This commit is contained in:
Matias Alejo Garcia 2016-06-07 16:16:38 -03:00
commit a130a3e19b
No known key found for this signature in database
GPG key ID: 02470DB551277AB3
2 changed files with 19 additions and 4 deletions

View file

@ -34,9 +34,17 @@
<div ng-show="type == '12' ">
<div class="box-notification m20b" ng-show="import.error">
<span class="text-warning">
{{import.error|translate}}
</span>
<div ng-show="import.importErr" class="text-warning">
<div >
</div>
<div class="m10 text-bold" translate>Could not access the wallet at the server. Please check:</div>
<div class="p25l" translate> The password of the recovery phrase (if set) </div>
<div class="p25l" translate> The derivation path</div>
<div class="p25l" translate> The wallet service URL </div>
<div class="p25l" translate> NOTE: To import a wallet from a 3rd party software, please go to Add Wallet &gt; Create Wallet, and specify the seed there.</div>
<div class="text-right"> <span translate>Error</span>: {{import.error|translate}}</div>
</div>
</div>
<div class="row large-12 columns">
<form name="importForm12" ng-submit="import.importMnemonic(importForm12)" novalidate>

View file

@ -12,6 +12,7 @@ angular.module('copayApp.controllers').controller('importController',
$scope.bwsurl = defaults.bws.url;
$scope.derivationPath = derivationPathHelper.default;
$scope.account = 1;
self.importErr = false;
window.ignoreMobilePause = true;
$scope.$on('$destroy', function() {
@ -20,6 +21,7 @@ angular.module('copayApp.controllers').controller('importController',
}, 100);
});
var updateSeedSourceSelect = function() {
self.seedOptions = [];
@ -52,7 +54,7 @@ angular.module('copayApp.controllers').controller('importController',
try {
str2 = sjcl.decrypt(self.password, str);
} catch (e) {
err = gettext('Could not decrypt file, check your spending password');
err = gettext('Could not decrypt file, check your password');
$log.warn(e);
};
@ -92,6 +94,8 @@ angular.module('copayApp.controllers').controller('importController',
self.loading = false;
if (err) {
self.error = err;
self.importErr = true;
$ionicScrollDelegate.scrollTop();
return $timeout(function() {
$scope.$apply();
@ -112,6 +116,8 @@ angular.module('copayApp.controllers').controller('importController',
self.loading = false;
if (err) {
self.error = err;
self.importErr = true;
$ionicScrollDelegate.scrollTop();
return $timeout(function() {
$scope.$apply();
@ -265,6 +271,7 @@ angular.module('copayApp.controllers').controller('importController',
return;
}
this.error = '';
this.importErr = false;
var account = +$scope.account;