complete passphrase verification - add spinner

This commit is contained in:
Javier 2015-11-19 10:45:57 -03:00
commit 75707b4a93
5 changed files with 41 additions and 6 deletions

View file

@ -32,7 +32,8 @@ angular.module('copayApp.controllers').controller('backupWordsController',
}
self.addButton = function(word) {
var btnhtml = '<button class="button radius tiny" style="white-space:nowrap" ' +
var btnhtml = '<button class="button radius tiny"' +
'ng-style="{\'background-color\':index.backgroundColor}"' +
'data-ng-click="backupWordsC.removeButton($event)" id="_' + word + '" > ' + word + ' </button>';
var temp = $compile(btnhtml)($scope);
angular.element(document.getElementById('addWord')).append(temp);

View file

@ -39,7 +39,6 @@ angular.module('copayApp.controllers').controller('backupController',
self.credentialsEncrypted = false;
setWords(fc.getMnemonic());
// $rootScope.$emit('Local/BackupDone');
});
}
}

View file

@ -6,11 +6,19 @@ angular.module('copayApp.controllers').controller('backupPassphraseController',
var self = this;
var fc = profileService.focusedClient;
self.passphraseSuccess = false;
self.checkingPassphrase = false;
self.error = "";
setWords(fc.getMnemonic());
var words = fc.getMnemonic();
self.changePassphrase = function() {
self.passphraseSuccess = false;
$timeout(function() {
$rootScope.$apply();
}, 1);
}
function setWords(words) {
if (words) {
self.mnemonicWords = words.split(/[\u3000\s]+/);
@ -20,6 +28,9 @@ angular.module('copayApp.controllers').controller('backupPassphraseController',
};
self.confirm = function() {
self.checkingPassphrase = true;
self.error = "";
var walletClient = bwcService.getClient();
walletClient.importFromMnemonic(words, {
@ -27,8 +38,19 @@ angular.module('copayApp.controllers').controller('backupPassphraseController',
passphrase: $scope.passphrase,
account: 0,
}, function(err) {
if (err)
self.checkingPassphrase = false;
if (err) {
self.error = err.message;
$timeout(function() {
$rootScope.$apply();
}, 1);
return;
}
self.passphraseSuccess = true;
$timeout(function() {
$rootScope.$apply();
}, 1);
});
}
});