mirror of https://github.com/BTCPrivate/copay.git
Merge pull request #719 from yemel/anti-feature/remove-email-backup
Remove email backup feature
This commit is contained in:
commit
a07957d4a3
19
index.html
19
index.html
|
@ -768,28 +768,13 @@
|
||||||
<p> Download File </p>
|
<p> Download File </p>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="large-6 medium-6 columns">
|
<div class="row text-center small" style="margin-top:70px">
|
||||||
<a class="panel radius box-backup" ng-click="openModal()">
|
<div class="button radius warning" ng-really-message="Are you sure to delete this wallet from this computer?" ng-really-click="deleteWallet()">Delete this wallet from this computer</div>
|
||||||
<i class="fi-mail size-72"></i>
|
|
||||||
<p> Backup to email </p>
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row text-center small" style="margin-top:20px">
|
|
||||||
<div class="button radius warning" ng-really-message="Are you sure to delete this wallet from this computer?" ng-really-click="deleteWallet()">Delete this wallet from this computer</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/ng-template" id="backupModal.html">
|
|
||||||
<h3>Insert your email</h3>
|
|
||||||
<form name="emailForm" ng-submit="submit(emailForm)">
|
|
||||||
<p><input type="email" ng-model="$parent.email" placeholder="your@email.com" required/></p>
|
|
||||||
<input type="submit" class="button" value="Send" ng-disabled="emailForm.$invalid"/>
|
|
||||||
</form>
|
|
||||||
<a class="close-reveal-modal" ng-click="cancel()">×</a>
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<!-- CONFIG -->
|
<!-- CONFIG -->
|
||||||
<script type="text/ng-template" id="settings.html">
|
<script type="text/ng-template" id="settings.html">
|
||||||
<div class="settings" ng-controller="SettingsController">
|
<div class="settings" ng-controller="SettingsController">
|
||||||
|
|
|
@ -8,17 +8,6 @@ angular.module('copayApp.controllers').controller('BackupController',
|
||||||
backupService.download($rootScope.wallet);
|
backupService.download($rootScope.wallet);
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.openModal = function() {
|
|
||||||
var modalInstance = $modal.open({
|
|
||||||
templateUrl: 'backupModal.html',
|
|
||||||
controller: ModalInstanceCtrl,
|
|
||||||
});
|
|
||||||
|
|
||||||
modalInstance.result.then(function(email) {
|
|
||||||
backupService.sendEmail(email, $rootScope.wallet);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.deleteWallet = function() {
|
$scope.deleteWallet = function() {
|
||||||
var w = $rootScope.wallet;
|
var w = $rootScope.wallet;
|
||||||
w.disconnect();
|
w.disconnect();
|
||||||
|
@ -28,14 +17,3 @@ angular.module('copayApp.controllers').controller('BackupController',
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var ModalInstanceCtrl = function($scope, $modalInstance) {
|
|
||||||
|
|
||||||
$scope.submit = function(form) {
|
|
||||||
$modalInstance.close($scope.email);
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.cancel = function() {
|
|
||||||
$modalInstance.dismiss('cancel');
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
|
@ -30,22 +30,4 @@ BackupService.prototype.download = function(wallet) {
|
||||||
saveAs(blob, filename);
|
saveAs(blob, filename);
|
||||||
};
|
};
|
||||||
|
|
||||||
BackupService.prototype.sendEmail = function(email, wallet) {
|
|
||||||
var ew = wallet.toEncryptedObj();
|
|
||||||
var body = ew;
|
|
||||||
var subject = this.getName(wallet);
|
|
||||||
var href = 'mailto:' + email + '?' + 'subject=[Copay Backup] ' + subject + '&' + 'body=' + body;
|
|
||||||
|
|
||||||
if (window.cshell) {
|
|
||||||
return window.cshell.send('backup:email', href);
|
|
||||||
}
|
|
||||||
|
|
||||||
var newWin = window.open(href, '_blank', 'scrollbars=yes,resizable=yes,width=10,height=10');
|
|
||||||
if (newWin) {
|
|
||||||
setTimeout(function() {
|
|
||||||
newWin.close();
|
|
||||||
}, 1000);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
angular.module('copayApp.services').service('backupService', BackupService);
|
angular.module('copayApp.services').service('backupService', BackupService);
|
||||||
|
|
|
@ -107,10 +107,4 @@ describe("Unit: Backup Service", function() {
|
||||||
backupService.download(new FakeWallet());
|
backupService.download(new FakeWallet());
|
||||||
expectation.once();
|
expectation.once();
|
||||||
}));
|
}));
|
||||||
it('should backup by email', inject(function(backupService) {
|
|
||||||
var mock = sinon.mock(window);
|
|
||||||
var expectation = mock.expects('open');
|
|
||||||
backupService.sendEmail('fake@test.com', new FakeWallet());
|
|
||||||
expectation.once();
|
|
||||||
}));
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue