WIP passphrase confirm - add passphrase view and separate controllers

This commit is contained in:
Javier 2015-11-18 18:37:42 -03:00
commit 4d94121ec6
11 changed files with 234 additions and 134 deletions

View file

@ -0,0 +1,34 @@
'use strict';
angular.module('copayApp.controllers').controller('backupPassphraseController',
function($rootScope, $scope, $timeout, $log, $compile, bwcService, lodash, profileService, go, gettext, confirmDialog, notification, bwsError) {
var self = this;
var fc = profileService.focusedClient;
self.passphraseSuccess = false;
self.error = "";
setWords(fc.getMnemonic());
var words = fc.getMnemonic();
function setWords(words) {
if (words) {
self.mnemonicWords = words.split(/[\u3000\s]+/);
self.mnemonicHasPassphrase = fc.mnemonicHasPassphrase();
self.useIdeograms = words.indexOf("\u3000") >= 0;
}
};
self.confirm = function() {
var walletClient = bwcService.getClient();
walletClient.importFromMnemonic(words, {
network: 'livenet',
passphrase: $scope.passphrase,
account: 0,
}, function(err) {
if (err)
self.error = err.message;
});
}
});