1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-09-18 02:41:15 +02:00

premium required messages

This commit is contained in:
Kyle Spearrin 2017-07-06 16:15:28 -04:00
parent 8df16f28e7
commit dfd791ecf9
9 changed files with 119 additions and 30 deletions

View File

@ -77,6 +77,7 @@ angular.module('bit')
description: 'Verification codes will be emailed to you.',
enabled: false,
active: true,
free: true,
image: 'gmail.png',
displayOrder: 4,
priority: 0

View File

@ -0,0 +1,17 @@
angular
.module('bit.global')
.controller('premiumRequiredController', function ($scope, $state, $uibModalInstance, $analytics) {
$analytics.eventTrack('premiumRequiredController', { category: 'Modal' });
$scope.go = function () {
$analytics.eventTrack('Get Premium');
$state.go('backend.user.settingsPremium').then(function () {
$scope.close();
});
};
$scope.close = function () {
$uibModalInstance.dismiss('close');
};
});

View File

@ -2,23 +2,40 @@
.module('bit.settings')
.controller('settingsTwoStepController', function ($scope, apiService, toastr, $analytics, constants,
$filter, $uibModal) {
$filter, $uibModal, authService) {
$scope.providers = constants.twoFactorProviderInfo;
$scope.premium = true;
apiService.twoFactor.list({}, function (response) {
for (var i = 0; i < response.Data.length; i++) {
if (!response.Data[i].Enabled) {
continue;
}
authService.getUserProfile().then(function (profile) {
$scope.premium = profile.premium;
return apiService.twoFactor.list({}).$promise;
}).then(function (response) {
if (response.Data) {
for (var i = 0; i < response.Data.length; i++) {
if (!response.Data[i].Enabled) {
continue;
}
var provider = $filter('filter')($scope.providers, { type: response.Data[i].Type });
if (provider.length) {
provider[0].enabled = true;
var provider = $filter('filter')($scope.providers, { type: response.Data[i].Type });
if (provider.length) {
provider[0].enabled = true;
}
}
}
return;
});
$scope.edit = function (provider) {
if (!$scope.premium && !provider.free) {
$uibModal.open({
animation: true,
templateUrl: 'app/views/premiumRequired.html',
controller: 'premiumRequiredController'
});
return;
}
if (provider.type === constants.twoFactorProvider.authenticator) {
typeName = 'Authenticator';
}

View File

@ -11,7 +11,7 @@
<ul class="fa-ul">
<li>
<i class="fa-li fa fa-check text-green"></i>
1 GB of encrypted file storage
1 GB of encrypted file storage.
</li>
<li>
<i class="fa-li fa fa-check text-green"></i>

View File

@ -25,14 +25,17 @@
<tbody>
<tr ng-repeat="provider in providers | orderBy: 'displayOrder'">
<td style="width: 120px; height: 75px;" align="center">
<img alt="{{::provider.name}}" ng-src="{{'images/two-factor/' + provider.image}}" />
<a href="#" stop-click ng-click="edit(provider)">
<img alt="{{::provider.name}}" ng-src="{{'images/two-factor/' + provider.image}}" />
</a>
</td>
<td>
<a href="#" stop-click ng-click="edit(provider)">{{::provider.name}}</a>
<span class="label label-info" ng-if="!premium && !provider.free">PREMIUM</span>
<div class="text-muted text-sm">{{::provider.description}}</div>
</td>
<td style="width: 100px;" class="text-right">
<span class="label"
<span class="label label-full"
ng-class="{ 'label-success': provider.enabled, 'label-default': !provider.enabled }">
{{provider.enabled ? 'Enabled' : 'Disabled'}}
</span>

View File

@ -200,22 +200,35 @@
};
$scope.attachments = function (login) {
if (!cryptoService.getEncKey()) {
toastr.error('You cannot use this feature until you update your encryption key.', 'Feature Unavailable');
return;
}
var addModel = $uibModal.open({
animation: true,
templateUrl: 'app/vault/views/vaultAttachments.html',
controller: 'vaultAttachmentsController',
resolve: {
loginId: function () { return login.id; }
authService.getUserProfile().then(function (profile) {
return profile.premium;
}).then(function (isPremium) {
if (!isPremium) {
$uibModal.open({
animation: true,
templateUrl: 'app/views/premiumRequired.html',
controller: 'premiumRequiredController'
});
return;
}
});
addModel.result.then(function (data) {
if (!cryptoService.getEncKey()) {
toastr.error('You cannot use this feature until you update your encryption key.', 'Feature Unavailable');
return;
}
var addModel = $uibModal.open({
animation: true,
templateUrl: 'app/vault/views/vaultAttachments.html',
controller: 'vaultAttachmentsController',
resolve: {
loginId: function () { return login.id; }
}
});
addModel.result.then(function (data) {
});
});
};

View File

@ -0,0 +1,36 @@
<div class="modal-header">
<button type="button" class="close" ng-click="close()" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title"><i class="fa fa-star"></i> Premium <span class="hidden-xs">Membership</span> Required</h4>
</div>
<div class="modal-body">
<p>This features requires a premium membership. Sign up for premium and get:</p>
<ul class="fa-ul">
<li>
<i class="fa-li fa fa-check text-green"></i>
1 GB of encrypted file storage.
</li>
<li>
<i class="fa-li fa fa-check text-green"></i>
Additional two-step login options such as YubiKey, FIDO U2F, and Duo.
</li>
<li>
<i class="fa-li fa fa-check text-green"></i>
TOTP verification code (2FA) generator for logins in your vault.
</li>
<li>
<i class="fa-li fa fa-check text-green"></i>
Priority customer support.
</li>
<li>
<i class="fa-li fa fa-check text-green"></i>
All future premium features. More coming soon!
</li>
</ul>
All for just <b>{{10 | currency:"$":0}}</b> /year.
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary btn-flat" ng-click="go()">
Get Premium
</button>
<button type="button" class="btn btn-default btn-flat" ng-click="close()">Close</button>
</div>

View File

@ -143,6 +143,7 @@
<script src="app/global/topNavController.js"></script>
<script src="app/global/sideNavController.js"></script>
<script src="app/global/appsController.js"></script>
<script src="app/global/premiumRequiredController.js"></script>
<script src="app/accounts/accountsModule.js"></script>
<script src="app/accounts/accountsLoginController.js"></script>

View File

@ -261,6 +261,7 @@ form .btn .loading-icon {
}
/* Forms */
.form-control {
border-radius: 0 !important;
}
@ -353,11 +354,6 @@ form .btn .loading-icon {
vertical-align: middle !important;
}
.table td .label {
font-size: 85%;
font-weight: normal;
}
.box-header.with-border + .box-body .table > tbody > tr:first-child > td {
border-top: 0;
}
@ -623,3 +619,8 @@ h1, h2, h3, h4, h5, h6 {
border: none;
}
}
.label-full {
font-size: 85%;
font-weight: normal;
}