clean code

This commit is contained in:
Javier 2015-11-30 18:00:15 -03:00
commit d12a24853a
2 changed files with 1 additions and 21 deletions

View file

@ -118,7 +118,7 @@
<div class="panel words text-left" ng-class="{'enable_text_select': index.network == 'testnet'}">
<div id="addWord"></div>
</div>
<div class="text-left" ng-class="{'enable_text_select': index.network == 'testnet'}">
<div class="text-left" ng-class="{'enable_text_select': index.network == 'testnet'}" id="buttons">
<span ng-repeat="word in wordsC.shuffledMnemonicWords track by $index">
<button class="button radius tiny words" ng-if="$index > 9" ng-click="wordsC.disableButton($index, word)" id="{{$index + word}}">{{word}}</button>
<button class="button radius tiny words" ng-if="$index <= 9" ng-click="wordsC.disableButton('0' + $index, word)" id="{{'0' + $index + word}}">{{word}}</button>

View file

@ -31,13 +31,6 @@ angular.module('copayApp.controllers').controller('backupController',
initWords();
}
function getMnemonic() {
mnemonic = fc.getMnemonic();
self.xPrivKey = fc.credentials.xPrivKey;
profileService.lockFC();
return mnemonic;
}
self.goToStep = function(n) {
self.step = n;
if (self.step == 1)
@ -51,19 +44,12 @@ angular.module('copayApp.controllers').controller('backupController',
function initWords() {
var words = fc.getMnemonic();
console.log('words: ', fc.getMnemonic());
console.log('credentials: ', fc.credentials);
self.xPrivKey = fc.credentials.xPrivKey;
profileService.lockFC();
self.mnemonicWords = words.split(/[\u3000\s]+/);
self.shuffledMnemonicWords = lodash.sortBy(self.mnemonicWords);;
self.mnemonicHasPassphrase = fc.mnemonicHasPassphrase();
self.useIdeograms = words.indexOf("\u3000") >= 0;
console.log('self.mnemonicWords: ', self.mnemonicWords);
console.log('self.shuffledMnemonicWords: ', self.shuffledMnemonicWords);
console.log('self.mnemonicHasPassphrase: ', self.mnemonicHasPassphrase);
};
self.toggle = function() {
@ -158,14 +144,10 @@ angular.module('copayApp.controllers').controller('backupController',
function confirm() {
self.backupError = false;
console.log('Original words: ', self.mnemonicWords);
var walletClient = bwcService.getClient();
var separator = self.useIdeograms ? '\u3000' : ' ';
var customSentence = lodash.pluck(customWords, 'word').join(separator);
var passphrase = $scope.passphrase || '';
console.log('Custom: ', customSentence);
try {
walletClient.seedFromMnemonic(customSentence, {
@ -178,8 +160,6 @@ angular.module('copayApp.controllers').controller('backupController',
}
if (walletClient.credentials.xPrivKey != self.xPrivKey) {
console.log('wc privKey: ', walletClient.credentials.xPrivKey);
console.log('self.xPrivKey: ', self.xPrivKey);
return backupError('Private key mismatch');
}