clean code
This commit is contained in:
parent
d10a840c5d
commit
d12a24853a
2 changed files with 1 additions and 21 deletions
|
|
@ -118,7 +118,7 @@
|
||||||
<div class="panel words text-left" ng-class="{'enable_text_select': index.network == 'testnet'}">
|
<div class="panel words text-left" ng-class="{'enable_text_select': index.network == 'testnet'}">
|
||||||
<div id="addWord"></div>
|
<div id="addWord"></div>
|
||||||
</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">
|
<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($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>
|
<button class="button radius tiny words" ng-if="$index <= 9" ng-click="wordsC.disableButton('0' + $index, word)" id="{{'0' + $index + word}}">{{word}}</button>
|
||||||
|
|
|
||||||
|
|
@ -31,13 +31,6 @@ angular.module('copayApp.controllers').controller('backupController',
|
||||||
initWords();
|
initWords();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMnemonic() {
|
|
||||||
mnemonic = fc.getMnemonic();
|
|
||||||
self.xPrivKey = fc.credentials.xPrivKey;
|
|
||||||
profileService.lockFC();
|
|
||||||
return mnemonic;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.goToStep = function(n) {
|
self.goToStep = function(n) {
|
||||||
self.step = n;
|
self.step = n;
|
||||||
if (self.step == 1)
|
if (self.step == 1)
|
||||||
|
|
@ -51,19 +44,12 @@ angular.module('copayApp.controllers').controller('backupController',
|
||||||
|
|
||||||
function initWords() {
|
function initWords() {
|
||||||
var words = fc.getMnemonic();
|
var words = fc.getMnemonic();
|
||||||
console.log('words: ', fc.getMnemonic());
|
|
||||||
console.log('credentials: ', fc.credentials);
|
|
||||||
self.xPrivKey = fc.credentials.xPrivKey;
|
self.xPrivKey = fc.credentials.xPrivKey;
|
||||||
profileService.lockFC();
|
profileService.lockFC();
|
||||||
|
|
||||||
self.mnemonicWords = words.split(/[\u3000\s]+/);
|
self.mnemonicWords = words.split(/[\u3000\s]+/);
|
||||||
self.shuffledMnemonicWords = lodash.sortBy(self.mnemonicWords);;
|
self.shuffledMnemonicWords = lodash.sortBy(self.mnemonicWords);;
|
||||||
self.mnemonicHasPassphrase = fc.mnemonicHasPassphrase();
|
self.mnemonicHasPassphrase = fc.mnemonicHasPassphrase();
|
||||||
self.useIdeograms = words.indexOf("\u3000") >= 0;
|
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() {
|
self.toggle = function() {
|
||||||
|
|
@ -158,14 +144,10 @@ angular.module('copayApp.controllers').controller('backupController',
|
||||||
function confirm() {
|
function confirm() {
|
||||||
self.backupError = false;
|
self.backupError = false;
|
||||||
|
|
||||||
console.log('Original words: ', self.mnemonicWords);
|
|
||||||
|
|
||||||
var walletClient = bwcService.getClient();
|
var walletClient = bwcService.getClient();
|
||||||
var separator = self.useIdeograms ? '\u3000' : ' ';
|
var separator = self.useIdeograms ? '\u3000' : ' ';
|
||||||
var customSentence = lodash.pluck(customWords, 'word').join(separator);
|
var customSentence = lodash.pluck(customWords, 'word').join(separator);
|
||||||
|
|
||||||
var passphrase = $scope.passphrase || '';
|
var passphrase = $scope.passphrase || '';
|
||||||
console.log('Custom: ', customSentence);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
walletClient.seedFromMnemonic(customSentence, {
|
walletClient.seedFromMnemonic(customSentence, {
|
||||||
|
|
@ -178,8 +160,6 @@ angular.module('copayApp.controllers').controller('backupController',
|
||||||
}
|
}
|
||||||
|
|
||||||
if (walletClient.credentials.xPrivKey != self.xPrivKey) {
|
if (walletClient.credentials.xPrivKey != self.xPrivKey) {
|
||||||
console.log('wc privKey: ', walletClient.credentials.xPrivKey);
|
|
||||||
console.log('self.xPrivKey: ', self.xPrivKey);
|
|
||||||
return backupError('Private key mismatch');
|
return backupError('Private key mismatch');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue