1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

web vault url environment for U2F

This commit is contained in:
Kyle Spearrin
2017-08-28 18:08:08 -04:00
parent ad544e5240
commit c66803ce1f
6 changed files with 35 additions and 4 deletions

View File

@@ -2,11 +2,24 @@
.module('bit.accounts')
.controller('accountsLoginTwoFactorController', function ($scope, $state, authService, toastr, utilsService, SweetAlert,
$analytics, i18nService, $stateParams, $filter, constantsService, $timeout, $window, cryptoService, apiService) {
$analytics, i18nService, $stateParams, $filter, constantsService, $timeout, $window, cryptoService, apiService,
$window) {
$scope.i18n = i18nService;
utilsService.initListSectionItemListeners($(document), angular);
var u2f = new U2f(function (data) {
var customWebVaultUrl = null;
var storedBaseUrl = $window.localStorage.getItem(constantsService.baseUrlKey);
if (storedBaseUrl) {
customWebVaultUrl = storedBaseUrl;
}
else {
var storedWebVaultUrl = $window.localStorage.getItem(constantsService.webVaultUrlKey);
if (storedWebVaultUrl) {
customWebVaultUrl = storedWebVaultUrl;
}
}
var u2f = new U2f(customWebVaultUrl, function (data) {
$timeout(function () {
$scope.login(data);
});

View File

@@ -8,6 +8,7 @@
utilsService.initListSectionItemListeners($(document), angular);
$scope.baseUrl = $window.localStorage.getItem(constantsService.baseUrlKey) || '';
$scope.webVaultUrl = $window.localStorage.getItem(constantsService.webVaultUrlKey) || '';
$scope.apiUrl = $window.localStorage.getItem(constantsService.apiUrlKey) || '';
$scope.identityUrl = $window.localStorage.getItem(constantsService.identityUrlKey) || '';
@@ -20,6 +21,14 @@
$window.localStorage.removeItem(constantsService.baseUrlKey);
}
if ($scope.webVaultUrl && $scope.webVaultUrl !== '') {
$scope.webVaultUrl = formatUrl($scope.webVaultUrl);
$window.localStorage.setItem(constantsService.webVaultUrlKey, $scope.webVaultUrl);
}
else {
$window.localStorage.removeItem(constantsService.webVaultUrlKey);
}
if ($scope.apiUrl && $scope.apiUrl !== '') {
$scope.apiUrl = formatUrl($scope.apiUrl);
$window.localStorage.setItem(constantsService.apiUrlKey, $scope.apiUrl);

View File

@@ -30,6 +30,10 @@
{{i18n.customEnvironment}}
</div>
<div class="list-section-items">
<div class="list-section-item">
<label for="webVaultUrl" class="item-label">{{i18n.webVaultUrl}}</label>
<input id="webVaultUrl" type="text" name="WebVaultUrl" ng-model="webVaultUrl">
</div>
<div class="list-section-item">
<label for="apiUrl" class="item-label">{{i18n.apiUrl}}</label>
<input id="apiUrl" type="text" name="ApiUrl" ng-model="apiUrl">