From 3643222b3c52a64b630b90118715991ae4802db9 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 3 Apr 2018 14:33:00 -0400 Subject: [PATCH] added org duo to 2fa flow --- src/app/accounts/accountsLoginController.js | 5 +-- .../accountsTwoFactorMethodsController.js | 3 ++ .../views/accountsLoginTwoFactor.html | 3 +- src/app/constants.js | 31 +++++++++++-------- .../organizationSettingsController.js | 2 +- src/app/settings/settingsTwoStepController.js | 2 +- 6 files changed, 28 insertions(+), 18 deletions(-) diff --git a/src/app/accounts/accountsLoginController.js b/src/app/accounts/accountsLoginController.js index 9055b5ac31..94a86362f7 100644 --- a/src/app/accounts/accountsLoginController.js +++ b/src/app/accounts/accountsLoginController.js @@ -216,8 +216,9 @@ angular function init() { stopU2fCheck = true; var params; - if ($scope.twoFactorProvider === constants.twoFactorProvider.duo) { - params = $scope.twoFactorProviders[constants.twoFactorProvider.duo]; + if ($scope.twoFactorProvider === constants.twoFactorProvider.duo || + $scope.twoFactorProvider === constants.twoFactorProvider.organizationDuo) { + params = $scope.twoFactorProviders[$scope.twoFactorProvider]; $window.Duo.init({ host: params.Host, diff --git a/src/app/accounts/accountsTwoFactorMethodsController.js b/src/app/accounts/accountsTwoFactorMethodsController.js index 36f3be3d9e..15c179102f 100644 --- a/src/app/accounts/accountsTwoFactorMethodsController.js +++ b/src/app/accounts/accountsTwoFactorMethodsController.js @@ -6,6 +6,9 @@ $scope.providers = []; + if (providers.hasOwnProperty(constants.twoFactorProvider.organizationDuo)) { + add(constants.twoFactorProvider.organizationDuo); + } if (providers.hasOwnProperty(constants.twoFactorProvider.authenticator)) { add(constants.twoFactorProvider.authenticator); } diff --git a/src/app/accounts/views/accountsLoginTwoFactor.html b/src/app/accounts/views/accountsLoginTwoFactor.html index aa5e8db53e..744c9ea725 100644 --- a/src/app/accounts/views/accountsLoginTwoFactor.html +++ b/src/app/accounts/views/accountsLoginTwoFactor.html @@ -83,7 +83,8 @@ -
+
diff --git a/src/app/constants.js b/src/app/constants.js index b0e4ce69ff..24797a403d 100644 --- a/src/app/constants.js +++ b/src/app/constants.js @@ -99,14 +99,15 @@ angular.module('bit') type: 0, name: 'Authenticator App', description: 'Use an authenticator app (such as Authy or Google Authenticator) to generate time-based ' + - 'verification codes.', + 'verification codes.', enabled: false, active: true, free: true, image: 'authapp.png', displayOrder: 0, priority: 1, - requiresUsb: false + requiresUsb: false, + organization: false }, { type: 3, @@ -117,7 +118,8 @@ angular.module('bit') image: 'yubico.png', displayOrder: 1, priority: 3, - requiresUsb: true + requiresUsb: true, + organization: false }, { type: 2, @@ -128,7 +130,8 @@ angular.module('bit') image: 'duo.png', displayOrder: 2, priority: 2, - requiresUsb: false + requiresUsb: false, + organization: false }, { type: 4, @@ -139,7 +142,8 @@ angular.module('bit') image: 'fido.png', displayOrder: 3, priority: 4, - requiresUsb: true + requiresUsb: true, + organization: false }, { type: 1, @@ -151,20 +155,21 @@ angular.module('bit') image: 'gmail.png', displayOrder: 4, priority: 0, - requiresUsb: false - } - ], - orgTwoFactorProviderInfo: [ + requiresUsb: false, + organization: false + }, { type: 6, - name: 'Duo', - description: 'Verify with Duo Security using the Duo Mobile app, SMS, phone call, or U2F security key.', + name: 'Duo (Organization)', + description: 'Verify with Duo Security for your organization using the Duo Mobile app, SMS, ' + + 'phone call, or U2F security key.', enabled: false, active: true, image: 'duo.png', displayOrder: 1, - priority: 0, - requiresUsb: false + priority: 10, + requiresUsb: false, + organization: true } ], plans: { diff --git a/src/app/organization/organizationSettingsController.js b/src/app/organization/organizationSettingsController.js index 1ce066f644..1128b968d2 100644 --- a/src/app/organization/organizationSettingsController.js +++ b/src/app/organization/organizationSettingsController.js @@ -5,7 +5,7 @@ $analytics, appSettings, constants, $filter) { $scope.selfHosted = appSettings.selfHosted; $scope.model = {}; - $scope.twoStepProviders = constants.orgTwoFactorProviderInfo; + $scope.twoStepProviders = $filter('filter')(constants.twoFactorProviderInfo, { organization: true }); $scope.use2fa = false; $scope.$on('$viewContentLoaded', function () { diff --git a/src/app/settings/settingsTwoStepController.js b/src/app/settings/settingsTwoStepController.js index 630a9f10bf..58cd2efcc9 100644 --- a/src/app/settings/settingsTwoStepController.js +++ b/src/app/settings/settingsTwoStepController.js @@ -3,7 +3,7 @@ .controller('settingsTwoStepController', function ($scope, apiService, toastr, $analytics, constants, $filter, $uibModal, authService) { - $scope.providers = constants.twoFactorProviderInfo; + $scope.providers = $filter('filter')(constants.twoFactorProviderInfo, { organization: false }); $scope.premium = true; authService.getUserProfile().then(function (profile) {