1
0
mirror of https://github.com/bitwarden/web synced 2026-01-02 00:23:16 +00: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

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