diff --git a/src/app/config.js b/src/app/config.js
index 6382f42a0a..2be595c9f4 100644
--- a/src/app/config.js
+++ b/src/app/config.js
@@ -103,6 +103,12 @@ angular
controller: 'settingsDomainsController',
data: { pageTitle: 'Domain Settings' }
})
+ .state('backend.user.settingsTwoStep', {
+ url: '^/settings/two-step',
+ templateUrl: 'app/settings/views/settingsTwoStep.html',
+ controller: 'settingsTwoStepController',
+ data: { pageTitle: 'Two-step Login' }
+ })
.state('backend.user.settingsCreateOrg', {
url: '^/settings/create-organization',
templateUrl: 'app/settings/views/settingsCreateOrganization.html',
diff --git a/src/app/constants.js b/src/app/constants.js
index a69d725642..56e241c7b6 100644
--- a/src/app/constants.js
+++ b/src/app/constants.js
@@ -20,6 +20,13 @@ angular.module('bit')
accepted: 1,
confirmed: 2
},
+ twoFactorProvider: {
+ authenticator: 0,
+ email: 1,
+ duo: 2,
+ yubikey: 3,
+ u2f: 4
+ },
plans: {
free: {
basePrice: 0,
diff --git a/src/app/services/apiService.js b/src/app/services/apiService.js
index bd990542ec..4409c42acd 100644
--- a/src/app/services/apiService.js
+++ b/src/app/services/apiService.js
@@ -114,6 +114,11 @@
postDelete: { url: _apiUri + '/accounts/delete', method: 'POST', params: {} }
});
+ _service.twoFactor = $resource(_apiUri + '/two-factor', {}, {
+ get: { method: 'GET', params: { provider: '@provider' } },
+ list: { method: 'GET', params: {} }
+ });
+
_service.settings = $resource(_apiUri + '/settings', {}, {
getDomains: { url: _apiUri + '/settings/domains', method: 'GET', params: {} },
putDomains: { url: _apiUri + '/settings/domains', method: 'POST', params: {} },
@@ -135,7 +140,7 @@
});
_service.hibp = $resource('https://haveibeenpwned.com/api/v2/breachedaccount/:email', {}, {
- get: { method: 'GET', params: { email: '@email' }, isArray: true},
+ get: { method: 'GET', params: { email: '@email' }, isArray: true },
});
function transformUrlEncoded(data) {
diff --git a/src/app/settings/settingsTwoStepController.js b/src/app/settings/settingsTwoStepController.js
new file mode 100644
index 0000000000..6ac15275fa
--- /dev/null
+++ b/src/app/settings/settingsTwoStepController.js
@@ -0,0 +1,56 @@
+angular
+ .module('bit.settings')
+
+ .controller('settingsTwoStepController', function ($scope, apiService, authService, toastr, $analytics, constants,
+ $filter) {
+ $scope.providers = [
+ {
+ type: constants.twoFactorProvider.authenticator,
+ name: 'Authenticator App',
+ description: 'Use auth app.',
+ enabled: false,
+ free: true
+ },
+ {
+ type: constants.twoFactorProvider.yubikey,
+ name: 'YubiKey OTP',
+ description: '',
+ enabled: false
+ },
+ {
+ type: constants.twoFactorProvider.duo,
+ name: 'Duo',
+ description: '',
+ enabled: false
+ },
+ {
+ type: constants.twoFactorProvider.u2f,
+ name: 'FIDO U2F Security Key',
+ description: '',
+ enabled: false
+ },
+ {
+ type: constants.twoFactorProvider.email,
+ name: 'Email',
+ description: '',
+ enabled: false
+ }
+ ];
+
+ apiService.twoFactor.list({}, function (response) {
+ 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;
+ }
+ }
+ });
+
+ authService.getUserProfile().then(function (profile) {
+ _profile = profile;
+ });
+ });
diff --git a/src/app/settings/views/settingsTwoStep.html b/src/app/settings/views/settingsTwoStep.html
new file mode 100644
index 0000000000..1cf0088737
--- /dev/null
+++ b/src/app/settings/views/settingsTwoStep.html
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+ {{::provider.name}}
+ {{::provider.description}}
+ |
+
+
+ {{provider.enabled ? 'Enabled' : 'Disabled'}}
+
+ |
+
+
+
+
+
+
+
diff --git a/src/app/views/userLayout.html b/src/app/views/userLayout.html
index 18419096c8..2d628d6064 100644
--- a/src/app/views/userLayout.html
+++ b/src/app/views/userLayout.html
@@ -78,7 +78,7 @@
+ $state.is('backend.user.settingsCreateOrg') || $state.is('backend.user.settingsTwoStep')}">
Settings
+
+
+ Two-step Login
+
+
Domain Rules
diff --git a/src/index.html b/src/index.html
index ba75722a05..36b9fb6ada 100644
--- a/src/index.html
+++ b/src/index.html
@@ -191,6 +191,7 @@
+