backup a wallet during creation. View wallet/profile backup in plain text for safari
This commit is contained in:
parent
c01cdb8b25
commit
93907dbfd1
5 changed files with 29 additions and 4 deletions
|
|
@ -21,11 +21,11 @@ angular.module('copayApp.controllers').controller('CopayersController',
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.downloadBackup = function(w) {
|
$scope.downloadBackup = function(w) {
|
||||||
backupService.download(w);
|
backupService.walletDownload(w);
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.viewBackup = function(w) {
|
$scope.viewBackup = function(w) {
|
||||||
$scope.backupPlainText = backupService.getBackup(w);
|
$scope.backupPlainText = backupService.walletEncrypted(w);
|
||||||
$scope.hideViewBackup = true;
|
$scope.hideViewBackup = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,13 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
angular.module('copayApp.controllers').controller('ManageController', function($scope, $rootScope, $location, controllerUtils, backupService) {
|
angular.module('copayApp.controllers').controller('ManageController', function($scope, $rootScope, $location, controllerUtils, backupService) {
|
||||||
|
$scope.isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
|
||||||
|
|
||||||
$scope.downloadBackup = function() {
|
$scope.downloadBackup = function() {
|
||||||
backupService.profileDownload($rootScope.iden);
|
backupService.profileDownload($rootScope.iden);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.viewBackup = function() {
|
||||||
|
$scope.backupPlainText = backupService.profileEncrypted($rootScope.iden);
|
||||||
|
$scope.hideViewBackup = true;
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ angular.module('copayApp.controllers').controller('MoreController',
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.viewBackup = function() {
|
$scope.viewBackup = function() {
|
||||||
$scope.backupPlainText = backupService.getBackup(w);
|
$scope.backupPlainText = backupService.walletEncrypted(w);
|
||||||
$scope.hideViewBackup = true;
|
$scope.hideViewBackup = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,9 @@ BackupService.prototype._download = function(ew, walletName, filename) {
|
||||||
saveAs(blob, filename);
|
saveAs(blob, filename);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
BackupService.prototype.walletEncrypted = function(wallet) {
|
||||||
|
return wallet.toEncryptedObj();
|
||||||
|
}
|
||||||
|
|
||||||
BackupService.prototype.walletDownload = function(wallet) {
|
BackupService.prototype.walletDownload = function(wallet) {
|
||||||
var ew = wallet.toEncryptedObj();
|
var ew = wallet.toEncryptedObj();
|
||||||
|
|
@ -48,6 +51,10 @@ BackupService.prototype.walletDownload = function(wallet) {
|
||||||
this._download(ew, walletName, filename)
|
this._download(ew, walletName, filename)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
BackupService.prototype.profileEncrypted = function(iden) {
|
||||||
|
return iden.toEncryptedObj();
|
||||||
|
}
|
||||||
|
|
||||||
BackupService.prototype.profileDownload = function(iden) {
|
BackupService.prototype.profileDownload = function(iden) {
|
||||||
var ew = iden.toEncryptedObj();
|
var ew = iden.toEncryptedObj();
|
||||||
var name = iden.profile.getName();
|
var name = iden.profile.getName();
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,19 @@
|
||||||
<h3><i class="fi-download m10r"></i> <span translate>Manage Wallets</span> </h3>
|
<h3><i class="fi-download m10r"></i> <span translate>Manage Wallets</span> </h3>
|
||||||
<p translate class="large-8 columns text-gray">It's important to backup your profile so that you can recover it in case of disaster. The backup will include all your profile's wallets</p>
|
<p translate class="large-8 columns text-gray">It's important to backup your profile so that you can recover it in case of disaster. The backup will include all your profile's wallets</p>
|
||||||
<div class="large-4 columns">
|
<div class="large-4 columns">
|
||||||
<a translate class="button primary expand" ng-click="downloadBackup()">Backup profile</a>
|
<a translate class="button primary m0" ng-click="downloadBackup()"
|
||||||
|
ng-show="!isSafari">Backup profile</a>
|
||||||
|
<a translate class="button primary m0" ng-click="viewBackup()"
|
||||||
|
ng-show="isSafari && !hideViewBackup">View profile backup</a>
|
||||||
|
</div>
|
||||||
|
<div ng-show="backupPlainText">
|
||||||
|
<textarea readonly rows="5">{{backupPlainText}}</textarea>
|
||||||
|
<div class="show-for-large-up">
|
||||||
|
<span translate class="size-12">Copy to clipboard</span> <span class="btn-copy" clip-copy="backupPlainText"> </span>
|
||||||
|
</div>
|
||||||
|
<div class="hide-for-large-up">
|
||||||
|
<span translate class="size-12">Copy this text as it is in a safe place (notepad or email)</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="large-12 columns line-dashed-h m15b"></div>
|
<div class="large-12 columns line-dashed-h m15b"></div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue