premium required to download files

This commit is contained in:
Kyle Spearrin 2017-07-21 14:24:05 -04:00
parent a6ee05ef93
commit 5de607b2a2
3 changed files with 25 additions and 3 deletions

View File

@ -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."
}
}

View File

@ -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;
}

View File

@ -17,8 +17,7 @@
{{i18n.noAttachments}}
</div>
<div class="list-section-item" ng-repeat="attachment in login.attachments">
<a href="#" stop-click ng-click="download(attachment)">{{attachment.fileName}}</a>
<i class="fa fa-spin fa-spinner text-muted no-animation" ng-if="attachment.downloading"></i>
{{attachment.fileName}}
<span class="btn-list no-padding" stop-prop stop-click title="{{i18n.deleteAttachment}}"
ng-click="delete(attachment)">
<i class="fa fa-lg fa-trash"></i>