1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-01 16:13:27 +00:00

licensing options when self hosted

This commit is contained in:
Kyle Spearrin
2017-08-11 23:23:14 -04:00
parent a209c9450a
commit 2272bcac71
7 changed files with 498 additions and 420 deletions

View File

@@ -6,6 +6,7 @@
$scope.paymentSource = null;
$scope.subscription = null;
$scope.loading = true;
var license = null;
$scope.$on('$viewContentLoaded', function () {
load();
@@ -72,6 +73,26 @@
});
};
$scope.license = function () {
var licenseString = JSON.stringify(license, null, 2);
var licenseBlob = new Blob([licenseString]);
// IE hack. ref http://msdn.microsoft.com/en-us/library/ie/hh779016.aspx
if (window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveBlob(licenseBlob, 'bitwarden_premium_license.json');
}
else {
var a = window.document.createElement('a');
a.href = window.URL.createObjectURL(licenseBlob, { type: 'text/plain' });
a.download = 'bitwarden_premium_license.json';
document.body.appendChild(a);
// IE: "Access is denied".
// ref: https://connect.microsoft.com/IE/feedback/details/797361/ie-10-treats-blob-url-as-cross-origin-and-denies-access
a.click();
document.body.removeChild(a);
}
};
function load() {
authService.getUserProfile().then(function (profile) {
$scope.premium = profile.premium;
@@ -87,6 +108,8 @@
var i = 0;
license = billing.License;
$scope.storage = null;
if (billing && billing.MaxStorageGb) {
$scope.storage = {