diff --git a/index.html b/index.html
index 92ca3f2a6..0244dff27 100644
--- a/index.html
+++ b/index.html
@@ -565,19 +565,13 @@
{{title}}
-
+
-
-
+
Backup to email
diff --git a/js/controllers/backup.js b/js/controllers/backup.js
index 5ea246b3a..7919879f6 100644
--- a/js/controllers/backup.js
+++ b/js/controllers/backup.js
@@ -4,33 +4,20 @@ angular.module('copay.backup').controller('BackupController',
function($scope, $rootScope, $location, $window, $timeout) {
$scope.title = 'Backup';
- var filename = $rootScope.wallet.id + '.json.aes';
-
- // TODO: get the real encrypted wallet.
var _getEncryptedWallet = function() {
var wallet = $rootScope.wallet.toEncryptedObj();
return wallet;
};
- var _getWalletBlob = function() {
+ $scope.download = function() {
+ var timestamp = +(new Date);
+ var walletName = ($rootScope.wallet.name ? $rootScope.wallet.name : '') + '-' + $rootScope.wallet.id ;
+ var filename = walletName + '-' + timestamp + '.json.aes';
var wallet = _getEncryptedWallet();
var blob = new Blob([wallet], {type: 'text/plain;charset=utf-8'});
-
- return blob;
- };
-
- $scope.download = function() {
- var blob = _getWalletBlob();
saveAs(blob, filename);
};
- $scope.dropbox = function() {
- var blob = _getWalletBlob();
- var url = $window.URL.createObjectURL(blob);
-
- // TODO: send the blob to Dropbox, (if we can...)
- };
-
$scope.email = function() {
var email = prompt('Please enter your email addres.');
var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
@@ -40,9 +27,9 @@ angular.module('copay.backup').controller('BackupController',
} else {
if (email && email !== '') {
var body = _getEncryptedWallet();
- var subject = 'Copay Backup';
+ var subject = ($rootScope.wallet.name ? $rootScope.wallet.name + ' - ' : '') + $rootScope.wallet.id;
var href = 'mailto:' + email + '?'
- + 'subject=' + subject + '&'
+ + 'subject=[Copay Backup] ' + subject + '&'
+ 'body=' + body;
var newWin = $window.open(href, '_blank', 'scrollbars=yes,resizable=yes,width=10,height=10');