1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 09:13:33 +00:00

premium required for attachments

This commit is contained in:
Kyle Spearrin
2017-07-21 17:14:40 -04:00
parent 79383ed693
commit 24056163dd
3 changed files with 29 additions and 3 deletions

View File

@@ -2,13 +2,18 @@
.module('bit.vault')
.controller('vaultAttachmentsController', function ($scope, apiService, $uibModalInstance, cryptoService, cipherService,
loginId, $analytics, validationService, toastr, $timeout) {
loginId, $analytics, validationService, toastr, $timeout, authService, $uibModal) {
$analytics.eventTrack('vaultAttachmentsController', { category: 'Modal' });
$scope.login = {};
$scope.readOnly = true;
$scope.loading = true;
$scope.isPremium = true;
var closing = false;
authService.getUserProfile().then(function (profile) {
$scope.isPremium = profile.premium;
});
apiService.logins.get({ id: loginId }, function (login) {
$scope.login = cipherService.decryptLogin(login);
$scope.readOnly = !login.Edit;
@@ -51,6 +56,13 @@
$scope.download = function (attachment) {
attachment.loading = true;
if (!$scope.login.organizationId && !$scope.isPremium) {
attachment.loading = false;
alert('Premium membership is required to use this feature.');
return;
}
cipherService.downloadAndDecryptAttachment(getKeyForLogin(), attachment, true).then(function (res) {
$timeout(function () {
attachment.loading = false;
@@ -102,4 +114,12 @@
closing = true;
$uibModalInstance.close(!!$scope.login.attachments && $scope.login.attachments.length > 0);
});
$scope.showUpgrade = function () {
$uibModal.open({
animation: true,
templateUrl: 'app/views/premiumRequired.html',
controller: 'premiumRequiredController'
});
};
});