totp access for orgs

This commit is contained in:
Kyle Spearrin 2017-07-07 12:12:08 -04:00
parent ff729608e1
commit 49dbf4945f
11 changed files with 87 additions and 19 deletions

View File

@ -0,0 +1,17 @@
angular
.module('bit.global')
.controller('paidOrgRequiredController', function ($scope, $state, $uibModalInstance, $analytics, $uibModalStack, orgId) {
$analytics.eventTrack('paidOrgRequiredController', { category: 'Modal' });
$scope.go = function () {
$analytics.eventTrack('Get Paid Org');
$state.go('backend.org.billing', { orgId: orgId }).then(function () {
$scope.close();
});
};
$scope.close = function () {
$uibModalStack.dismissAll();
};
});

View File

@ -2,10 +2,15 @@
.module('bit.vault')
.controller('organizationVaultAddLoginController', function ($scope, apiService, $uibModalInstance, cryptoService,
cipherService, passwordService, $analytics, orgId) {
cipherService, passwordService, $analytics, authService, orgId, $uibModal) {
$analytics.eventTrack('organizationVaultAddLoginController', { category: 'Modal' });
$scope.login = {};
$scope.hideFolders = $scope.hideFavorite = true;
$scope.hideFolders = $scope.hideFavorite = $scope.fromOrg = true;
authService.getUserProfile().then(function (userProfile) {
var orgProfile = userProfile.organizations[orgId];
$scope.useTotp = orgProfile.useTotp;
});
$scope.savePromise = null;
$scope.save = function (model) {
@ -47,4 +52,15 @@
$scope.close = function () {
$uibModalInstance.dismiss('close');
};
$scope.showUpgrade = function () {
$uibModal.open({
animation: true,
templateUrl: 'app/views/paidOrgRequired.html',
controller: 'paidOrgRequiredController',
resolve: {
orgId: function () { return orgId; }
}
});
};
});

View File

@ -83,7 +83,8 @@
templateUrl: 'app/vault/views/vaultEditLogin.html',
controller: 'organizationVaultEditLoginController',
resolve: {
loginId: function () { return login.id; }
loginId: function () { return login.id; },
orgId: function () { return $state.params.orgId; }
}
});

View File

@ -2,10 +2,15 @@
.module('bit.vault')
.controller('organizationVaultEditLoginController', function ($scope, apiService, $uibModalInstance, cryptoService,
cipherService, passwordService, loginId, $analytics) {
cipherService, passwordService, loginId, $analytics, authService, orgId, $uibModal) {
$analytics.eventTrack('organizationVaultEditLoginController', { category: 'Modal' });
$scope.login = {};
$scope.hideFolders = $scope.hideFavorite = true;
$scope.hideFolders = $scope.hideFavorite = $scope.fromOrg = true;
authService.getUserProfile().then(function (userProfile) {
var orgProfile = userProfile.organizations[orgId];
$scope.useTotp = orgProfile.useTotp;
});
apiService.logins.getAdmin({ id: loginId }, function (login) {
$scope.login = cipherService.decryptLogin(login);
@ -66,4 +71,15 @@
$scope.close = function () {
$uibModalInstance.dismiss('cancel');
};
$scope.showUpgrade = function () {
$uibModal.open({
animation: true,
templateUrl: 'app/views/paidOrgRequired.html',
controller: 'paidOrgRequiredController',
resolve: {
orgId: function () { return orgId; }
}
});
};
});

View File

@ -143,8 +143,10 @@ angular
type: profile.Organizations[i].Type,
enabled: profile.Organizations[i].Enabled,
maxCollections: profile.Organizations[i].MaxCollections,
maxStorageGb: profile.Organizations[i].MaxStorageGb,
seats: profile.Organizations[i].Seats,
useGroups: profile.Organizations[i].UseGroups
useGroups: profile.Organizations[i].UseGroups,
useTotp: profile.Organizations[i].UseTotp
};
}
@ -174,8 +176,10 @@ angular
type: 0, // 0 = Owner
enabled: true,
maxCollections: org.MaxCollections,
maxStorageGb: org.MaxStorageGb,
seats: org.Seats,
useGroups: org.UseGroups
useGroups: org.UseGroups,
useTotp: org.UseTotp
};
profile.organizations[o.id] = o;

View File

@ -11,7 +11,7 @@
};
authService.getUserProfile().then(function (profile) {
$scope.premium = profile.premium;
$scope.useTotp = profile.premium;
});
$scope.savePromise = null;
@ -62,7 +62,7 @@
$uibModalInstance.dismiss('close');
};
$scope.showPremium = function () {
$scope.showUpgrade = function () {
$uibModal.open({
animation: true,
templateUrl: 'app/views/premiumRequired.html',

View File

@ -9,7 +9,7 @@
$scope.readOnly = false;
authService.getUserProfile().then(function (profile) {
$scope.premium = profile.premium;
$scope.useTotp = profile.premium;
});
apiService.logins.get({ id: loginId }, function (login) {
@ -99,7 +99,7 @@
$uibModalInstance.dismiss('cancel');
};
$scope.showPremium = function () {
$scope.showUpgrade = function () {
$uibModal.open({
animation: true,
templateUrl: 'app/views/premiumRequired.html',

View File

@ -88,10 +88,10 @@
</div>
</div>
<div class="col-md-6 totp-col">
<div totp="login.totp" id="verification-code" ng-if="premium"></div>
<div ng-if="!premium">
<a href="#" stop-click ng-click="showPremium()"><img src="images/totp-countdown.png" alt="" /></a>
<span class="label label-info clickable" ng-click="showPremium()">PREMIUM</span>
<div totp="login.totp" id="verification-code" ng-if="useTotp"></div>
<div ng-if="!useTotp">
<a href="#" stop-click ng-click="showUpgrade()"><img src="images/totp-countdown.png" alt="" /></a>
<span class="label label-info clickable" ng-click="showUpgrade()">{{fromOrg ? 'UPGRADE' : 'PREMIUM'}}</span>
</div>
</div>
</div>

View File

@ -100,10 +100,10 @@
</div>
</div>
<div class="col-md-6 totp-col">
<div totp="login.totp" id="verification-code" ng-if="premium"></div>
<div ng-if="!premium">
<a href="#" stop-click ng-click="showPremium()"><img src="images/totp-countdown.png" alt="" /></a>
<span class="label label-info clickable" ng-click="showPremium()">PREMIUM</span>
<div totp="login.totp" id="verification-code" ng-if="useTotp"></div>
<div ng-if="!useTotp">
<a href="#" stop-click ng-click="showUpgrade()"><img src="images/totp-countdown.png" alt="" /></a>
<span class="label label-info clickable" ng-click="showUpgrade()">{{fromOrg ? 'UPGRADE' : 'PREMIUM'}}</span>
</div>
</div>
</div>

View File

@ -0,0 +1,13 @@
<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> Paid Plan Required</h4>
</div>
<div class="modal-body">
This feature is not available for free organizations. Switch to a paid plan to unlock more features.
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary btn-flat" ng-click="go()">
Upgrade Organization
</button>
<button type="button" class="btn btn-default btn-flat" ng-click="close()">Close</button>
</div>

View File

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