1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-06 18:43:25 +00:00

2fa cleanup

This commit is contained in:
Kyle Spearrin
2017-06-23 12:39:56 -04:00
parent af56551fd2
commit dda64b301e
12 changed files with 90 additions and 147 deletions

View File

@@ -4,6 +4,7 @@ angular
.controller('accountsLoginController', function ($scope, $rootScope, $cookies, apiService, cryptoService, authService,
$state, constants, $analytics, $uibModal, $timeout, $window) {
$scope.state = $state;
$scope.twoFactorProviderConstants = constants.twoFactorProvider;
var returnState;
if (!$state.params.returnState && $state.params.org) {

View File

@@ -7,41 +7,34 @@
$scope.providers = [];
if (providers.hasOwnProperty(constants.twoFactorProvider.authenticator)) {
$scope.providers.push({
id: constants.twoFactorProvider.authenticator,
name: 'Authenticator App'
});
add(constants.twoFactorProvider.authenticator);
}
if (providers.hasOwnProperty(constants.twoFactorProvider.yubikey)) {
$scope.providers.push({
id: constants.twoFactorProvider.yubikey,
name: 'YubiKey'
});
add(constants.twoFactorProvider.yubikey);
}
if (providers.hasOwnProperty(constants.twoFactorProvider.email)) {
$scope.providers.push({
id: constants.twoFactorProvider.email,
name: 'Email'
});
add(constants.twoFactorProvider.email);
}
if (providers.hasOwnProperty(constants.twoFactorProvider.duo)) {
$scope.providers.push({
id: constants.twoFactorProvider.duo,
name: 'Duo'
});
add(constants.twoFactorProvider.duo);
}
if (providers.hasOwnProperty(constants.twoFactorProvider.u2f)) {
$scope.providers.push({
id: constants.twoFactorProvider.u2f,
name: 'FIDO U2F Security Key'
});
add(constants.twoFactorProvider.u2f);
}
$scope.choose = function (provider) {
$uibModalInstance.close(provider.id);
$uibModalInstance.close(provider.type);
};
$scope.close = function () {
$uibModalInstance.dismiss('close');
};
function add(type) {
for (var i = 0; i < constants.twoFactorProviderInfo.length; i++) {
if (constants.twoFactorProviderInfo[i].type === type) {
$scope.providers.push(constants.twoFactorProviderInfo[i]);
}
}
}
});

View File

@@ -1,8 +1,9 @@
<div ng-if="twoFactorProvider === 0 || twoFactorProvider === 1">
<p class="login-box-msg" ng-if="twoFactorProvider === 0">
<div ng-if="twoFactorProvider === twoFactorProviderConstants.authenticator ||
twoFactorProvider === twoFactorProviderConstants.email">
<p class="login-box-msg" ng-if="twoFactorProvider === twoFactorProviderConstants.authenticator">
Enter the 6 digit verification code from your authenticator app.
</p>
<p class="login-box-msg" ng-if="twoFactorProvider === 1">
<p class="login-box-msg" ng-if="twoFactorProvider === twoFactorProviderConstants.email">
Enter the 6 digit verification code that was emailed to you.
</p>
<form name="twoFactorForm" ng-submit="twoFactorForm.$valid && twoFactor(token)" api-form="twoFactorPromise">
@@ -30,7 +31,8 @@
</div>
</form>
</div>
<div ng-if="twoFactorProvider === 3">
<div ng-if="twoFactorProvider === twoFactorProviderConstants.yubikey">
<p class="login-box-msg">
Insert your YubiKey into a USB slot and touch its gold button.
</p>
@@ -58,7 +60,7 @@
</form>
</div>
<div ng-if="twoFactorProvider === 2">
<div ng-if="twoFactorProvider === twoFactorProviderConstants.duo">
<p class="login-box-msg">
Complete logging in with Duo.
</p>
@@ -85,7 +87,7 @@
</form>
</div>
<div ng-if="twoFactorProvider === 4">
<div ng-if="twoFactorProvider === twoFactorProviderConstants.u2f">
<p class="login-box-msg">
Complete logging in with U2F.
</p>

View File

@@ -2,9 +2,10 @@
<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-key"></i> Two-step Providers</h4>
</div>
<div class="modal-body no-padding">
<div class="modal-body">
<div class="list-group" ng-repeat="provider in providers">
<a href="#" stop-click class="list-group-item" ng-click="choose(provider)">
<img alt="{{::provider.name}}" ng-src="{{'images/two-factor/' + provider.image}}" class="pull-right hidden-xs" />
<h4 class="list-group-item-heading">{{::provider.name}}</h4>
<p class="list-group-item-text">{{::provider.description}}</p>
</a>