mirror of https://github.com/BTCPrivate/copay.git
password required in backup page
This commit is contained in:
parent
6a7209710b
commit
9a35c741a2
|
@ -8,7 +8,6 @@
|
|||
<div class="content preferences" ng-controller="wordsController as wordsC">
|
||||
<h4></h4>
|
||||
|
||||
|
||||
<div class="box-notification" ng-show="wordsC.error">
|
||||
<span class="text-warning">
|
||||
{{wordsC.error|translate}}
|
||||
|
@ -17,7 +16,7 @@
|
|||
|
||||
|
||||
|
||||
<div ng-show="wordsC.mnemonicWords">
|
||||
<div ng-show="wordsC.mnemonicWords || (wordsC.credentialsEncrypted && !wordsC.deleted)">
|
||||
<div class="row" ng-show="index.n==1">
|
||||
<div class="m10t columns size-14 text-gray">
|
||||
<span translate>
|
||||
|
@ -33,11 +32,11 @@
|
|||
<span translate>
|
||||
To restore this {{index.m}}-{{index.n}} <b>shared</b> wallet you will need
|
||||
</span>:
|
||||
<ol class="m10t columns size-14 text-gray">
|
||||
<li translate>Your wallet seed and access to the server that coordinated the initial wallet creation. You still need {{index.m}} keys to spend.</li>
|
||||
<li translate><b>OR</b> the wallet seed of <b>all</b> copayers in the wallet</li>
|
||||
<li translate><b>OR</b> 1 wallet export file and the remaining quorum of wallet seeds (e.g. in a 3-5 wallet: 1 wallet export file + 2 wallet seeds of any of the other copayers).</li>
|
||||
</ol>
|
||||
<ol class="m10t columns size-14 text-gray">
|
||||
<li translate>Your wallet seed and access to the server that coordinated the initial wallet creation. You still need {{index.m}} keys to spend.</li>
|
||||
<li translate><b>OR</b> the wallet seed of <b>all</b> copayers in the wallet</li>
|
||||
<li translate><b>OR</b> 1 wallet export file and the remaining quorum of wallet seeds (e.g. in a 3-5 wallet: 1 wallet export file + 2 wallet seeds of any of the other copayers).</li>
|
||||
</ol>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -46,22 +45,22 @@
|
|||
<span translate>
|
||||
To restore this {{index.m}}-{{index.n}} <b>shared</b> wallet you will need
|
||||
</span>:
|
||||
<ol class="m10t columns size-14 text-gray">
|
||||
<li translate>Your wallet seed and access to the server that coordinated the initial wallet creation. You still need {{index.m}} keys to spend.</li>
|
||||
<li translate><b>OR</b> the wallet seeds of <b>all</b> copayers in the wallet</li>
|
||||
</ol>
|
||||
<ol class="m10t columns size-14 text-gray">
|
||||
<li translate>Your wallet seed and access to the server that coordinated the initial wallet creation. You still need {{index.m}} keys to spend.</li>
|
||||
<li translate><b>OR</b> the wallet seeds of <b>all</b> copayers in the wallet</li>
|
||||
</ol>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row m20t" ng-show="!wordsC.mnemonicWords && !wordsC.credentialsEncrypted">
|
||||
|
||||
<div class="row m20t" ng-show="wordsC.deleted">
|
||||
<div class="columns size-14 text-gray text-center" translate>
|
||||
Wallet seed not available. You can still export it from Advanced > Export.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-show="wordsC.mnemonicWords">
|
||||
<div ng-show="wordsC.mnemonicWords || (wordsC.credentialsEncrypted && !wordsC.deleted)">
|
||||
<div class="row">
|
||||
<div class="m10t columns">
|
||||
<a class="button outline light-gray expand tiny" ng-click="wordsC.toggle()">
|
||||
|
|
|
@ -5,27 +5,37 @@ angular.module('copayApp.controllers').controller('wordsController',
|
|||
|
||||
var msg = gettext('Are you sure you want to delete the backup words?');
|
||||
var successMsg = gettext('Backup words deleted');
|
||||
this.show = false;
|
||||
|
||||
var self = this;
|
||||
self.show = false;
|
||||
var fc = profileService.focusedClient;
|
||||
|
||||
this.toggle = function() {
|
||||
this.show = !this.show;
|
||||
if (fc.isPrivKeyEncrypted()) self.credentialsEncrypted = true;
|
||||
else setWords(fc.getMnemonic());
|
||||
|
||||
if (this.show)
|
||||
if (fc.credentials && !fc.credentials.mnemonicEncrypted && !fc.credentials.mnemonic) {
|
||||
self.deleted = true;
|
||||
}
|
||||
|
||||
self.toggle = function() {
|
||||
self.error = "";
|
||||
self.show = !self.show;
|
||||
if (self.show)
|
||||
$rootScope.$emit('Local/BackupDone');
|
||||
|
||||
$timeout(function(){
|
||||
if (self.credentialsEncrypted)
|
||||
self.passwordRequest();
|
||||
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
}, 1);
|
||||
};
|
||||
|
||||
this.delete = function() {
|
||||
var fc = profileService.focusedClient;
|
||||
self.delete = function() {
|
||||
confirmDialog.show(msg, function(ok) {
|
||||
if (ok) {
|
||||
fc.clearMnemonic();
|
||||
profileService.updateCredentialsFC(function() {
|
||||
self.deleted = true;
|
||||
notification.success(successMsg);
|
||||
go.walletHome();
|
||||
});
|
||||
|
@ -33,12 +43,10 @@ angular.module('copayApp.controllers').controller('wordsController',
|
|||
});
|
||||
};
|
||||
|
||||
|
||||
$scope.$on('$destroy', function() {
|
||||
profileService.lockFC();
|
||||
});
|
||||
|
||||
|
||||
function setWords(words) {
|
||||
if (words) {
|
||||
self.mnemonicWords = words.split(/[\u3000\s]+/);
|
||||
|
@ -47,26 +55,28 @@ angular.module('copayApp.controllers').controller('wordsController',
|
|||
}
|
||||
};
|
||||
|
||||
var fc = profileService.focusedClient;
|
||||
try {
|
||||
setWords(fc.getMnemonic());
|
||||
} catch (e) {
|
||||
if (e.message && e.message.match(/encrypted/) && fc.isPrivKeyEncrypted()) {
|
||||
self.credentialsEncrypted = true;
|
||||
self.passwordRequest = function() {
|
||||
try {
|
||||
setWords(fc.getMnemonic());
|
||||
} catch (e) {
|
||||
if (e.message && e.message.match(/encrypted/) && fc.isPrivKeyEncrypted()) {
|
||||
self.credentialsEncrypted = true;
|
||||
|
||||
$timeout(function(){
|
||||
$scope.$apply();
|
||||
}, 1);
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
}, 1);
|
||||
|
||||
profileService.unlockFC(function(err) {
|
||||
if (err) {
|
||||
self.error = bwsError.msg(err, gettext('Could not decrypt'));
|
||||
$log.warn('Error decrypting credentials:',self.error); //TODO
|
||||
return;
|
||||
}
|
||||
self.credentialsEncrypted = false;
|
||||
setWords(fc.getMnemonic());
|
||||
});
|
||||
}
|
||||
profileService.unlockFC(function(err) {
|
||||
if (err) {
|
||||
self.error = bwsError.msg(err, gettext('Could not decrypt'));
|
||||
$log.warn('Error decrypting credentials:', self.error); //TODO
|
||||
self.show = !self.show;
|
||||
return;
|
||||
}
|
||||
self.credentialsEncrypted = false;
|
||||
setWords(fc.getMnemonic());
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue