mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-06 09:20:43 +01:00
premium check updates
This commit is contained in:
parent
d4759d4056
commit
a1dfd7493a
@ -8,15 +8,16 @@
|
||||
$scope.readOnly = true;
|
||||
$scope.loading = true;
|
||||
$scope.isPremium = true;
|
||||
$scope.canUseAttachments = true;
|
||||
var closing = false;
|
||||
|
||||
authService.getUserProfile().then(function (profile) {
|
||||
$scope.isPremium = profile.premium;
|
||||
});
|
||||
|
||||
apiService.logins.get({ id: loginId }, function (login) {
|
||||
return apiService.logins.get({ id: loginId }).$promise;
|
||||
}).then(function (login) {
|
||||
$scope.login = cipherService.decryptLogin(login);
|
||||
$scope.readOnly = !login.Edit;
|
||||
$scope.canUseAttachments = $scope.isPremium || $scope.login.organizationId;
|
||||
$scope.loading = false;
|
||||
}, function () {
|
||||
$scope.loading = false;
|
||||
@ -57,7 +58,7 @@
|
||||
$scope.download = function (attachment) {
|
||||
attachment.loading = true;
|
||||
|
||||
if (!$scope.login.organizationId && !$scope.isPremium) {
|
||||
if (!$scope.canUseAttachments) {
|
||||
attachment.loading = false;
|
||||
alert('Premium membership is required to use this feature.');
|
||||
return;
|
||||
|
@ -206,25 +206,27 @@
|
||||
orgUseStorage: login.organizationId && !!profile.organizations[login.organizationId].maxStorageGb
|
||||
};
|
||||
}).then(function (perms) {
|
||||
if (login.organizationId && !perms.orgUseStorage) {
|
||||
$uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/views/paidOrgRequired.html',
|
||||
controller: 'paidOrgRequiredController',
|
||||
resolve: {
|
||||
orgId: function () { return login.organizationId; }
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!login.hasAttachments) {
|
||||
if (login.organizationId && !perms.orgUseStorage) {
|
||||
$uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/views/paidOrgRequired.html',
|
||||
controller: 'paidOrgRequiredController',
|
||||
resolve: {
|
||||
orgId: function () { return login.organizationId; }
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!login.organizationId && !perms.isPremium) {
|
||||
$uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/views/premiumRequired.html',
|
||||
controller: 'premiumRequiredController'
|
||||
});
|
||||
return;
|
||||
if (!login.organizationId && !perms.isPremium) {
|
||||
$uibModal.open({
|
||||
animation: true,
|
||||
templateUrl: 'app/views/premiumRequired.html',
|
||||
controller: 'premiumRequiredController'
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!login.organizationId && !cryptoService.getEncKey()) {
|
||||
|
@ -48,7 +48,7 @@
|
||||
<div ng-if="!readOnly">
|
||||
<hr />
|
||||
<h4>Add New Attachment</h4>
|
||||
<div class="callout callout-warning" ng-if="!isPremium">
|
||||
<div class="callout callout-warning" ng-if="!canUseAttachments">
|
||||
<h4>Premium Membership Required</h4>
|
||||
<p>Premium membership is required to use this feature.</p>
|
||||
<button type="button" class="btn btn-default btn-flat" ng-click="showUpgrade()">Learn More</button>
|
||||
@ -59,7 +59,7 @@
|
||||
<li ng-repeat="e in form.$errors">{{e}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="form-group" show-error ng-if="isPremium">
|
||||
<div class="form-group" show-error ng-if="canUseAttachments">
|
||||
<label for="file" class="sr-only">File</label>
|
||||
<input type="file" id="file" name="file" />
|
||||
<p class="help-block">Maximum size per file is 100 MB.</p>
|
||||
@ -67,7 +67,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary btn-flat" ng-disabled="form.$loading" ng-if="!readOnly && isPremium">
|
||||
<button type="submit" class="btn btn-primary btn-flat" ng-disabled="form.$loading" ng-if="!readOnly && canUseAttachments">
|
||||
<i class="fa fa-refresh fa-spin loading-icon" ng-show="form.$loading"></i>Save
|
||||
</button>
|
||||
<button type="button" class="btn btn-default btn-flat" ng-click="close()">Close</button>
|
||||
|
Loading…
Reference in New Issue
Block a user