From 5de607b2a25422b0a65df5602daa92fed71f1b4c Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 21 Jul 2017 14:24:05 -0400 Subject: [PATCH] premium required to download files --- src/_locales/en/messages.json | 8 ++++++++ src/popup/app/vault/vaultViewLoginController.js | 17 ++++++++++++++++- src/popup/app/vault/views/vaultAttachments.html | 3 +-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index 3e821ed265..25e172a659 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -838,5 +838,13 @@ "disableAutoTotpCopyDesc": { "message": "If your login has an authenticator key attached to it, the TOTP verification code is automatically copied to your clipboard whenever you auto-fill the login.", "description": "If your login has an authenticator key attached to it, the TOTP verification code is automatically copied to your clipboard whenever you auto-fill the login." + }, + "premiumRequired": { + "message": "Premium Required", + "description": "Premium Required" + }, + "premiumRequiredDesc": { + "message": "A premium membership is required to use this feature.", + "description": "A premium membership is required to use this feature." } } diff --git a/src/popup/app/vault/vaultViewLoginController.js b/src/popup/app/vault/vaultViewLoginController.js index 4ea4bdbfdb..6ce0334292 100644 --- a/src/popup/app/vault/vaultViewLoginController.js +++ b/src/popup/app/vault/vaultViewLoginController.js @@ -2,7 +2,7 @@ angular .module('bit.vault') .controller('vaultViewLoginController', function ($scope, $state, $stateParams, loginService, toastr, $q, - $analytics, i18nService, utilsService, totpService, $timeout, tokenService, $window, cryptoService) { + $analytics, i18nService, utilsService, totpService, $timeout, tokenService, $window, cryptoService, SweetAlert) { $scope.i18n = i18nService; var from = $stateParams.from, totpInterval = null; @@ -105,6 +105,21 @@ angular }; $scope.download = function (attachment) { + if (!$scope.login.organizationId && !tokenService.getPremium()) { + SweetAlert.swal({ + title: i18nService.premiumRequired, + text: i18nService.premiumRequiredDesc, + showCancelButton: true, + confirmButtonText: i18nService.learnMore, + cancelButtonText: i18nService.cancel + }, function (confirmed) { + if (confirmed) { + chrome.tabs.create({ url: 'https://bitwarden.com' }); + } + }); + return; + } + if (attachment.downloading) { return; } diff --git a/src/popup/app/vault/views/vaultAttachments.html b/src/popup/app/vault/views/vaultAttachments.html index 848a88bfba..effa1bf522 100644 --- a/src/popup/app/vault/views/vaultAttachments.html +++ b/src/popup/app/vault/views/vaultAttachments.html @@ -17,8 +17,7 @@ {{i18n.noAttachments}}
- {{attachment.fileName}} - + {{attachment.fileName}}