web vault url environment for U2F
This commit is contained in:
parent
ad544e5240
commit
c66803ce1f
|
@ -724,6 +724,9 @@
|
||||||
"apiUrl": {
|
"apiUrl": {
|
||||||
"message": "API Server URL"
|
"message": "API Server URL"
|
||||||
},
|
},
|
||||||
|
"webVaultUrl": {
|
||||||
|
"message": "Web Vault Server URL"
|
||||||
|
},
|
||||||
"identityUrl": {
|
"identityUrl": {
|
||||||
"message": "Identity Server URL"
|
"message": "Identity Server URL"
|
||||||
},
|
},
|
||||||
|
|
|
@ -2,11 +2,24 @@
|
||||||
.module('bit.accounts')
|
.module('bit.accounts')
|
||||||
|
|
||||||
.controller('accountsLoginTwoFactorController', function ($scope, $state, authService, toastr, utilsService, SweetAlert,
|
.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;
|
$scope.i18n = i18nService;
|
||||||
utilsService.initListSectionItemListeners($(document), angular);
|
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 () {
|
$timeout(function () {
|
||||||
$scope.login(data);
|
$scope.login(data);
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
utilsService.initListSectionItemListeners($(document), angular);
|
utilsService.initListSectionItemListeners($(document), angular);
|
||||||
|
|
||||||
$scope.baseUrl = $window.localStorage.getItem(constantsService.baseUrlKey) || '';
|
$scope.baseUrl = $window.localStorage.getItem(constantsService.baseUrlKey) || '';
|
||||||
|
$scope.webVaultUrl = $window.localStorage.getItem(constantsService.webVaultUrlKey) || '';
|
||||||
$scope.apiUrl = $window.localStorage.getItem(constantsService.apiUrlKey) || '';
|
$scope.apiUrl = $window.localStorage.getItem(constantsService.apiUrlKey) || '';
|
||||||
$scope.identityUrl = $window.localStorage.getItem(constantsService.identityUrlKey) || '';
|
$scope.identityUrl = $window.localStorage.getItem(constantsService.identityUrlKey) || '';
|
||||||
|
|
||||||
|
@ -20,6 +21,14 @@
|
||||||
$window.localStorage.removeItem(constantsService.baseUrlKey);
|
$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 !== '') {
|
if ($scope.apiUrl && $scope.apiUrl !== '') {
|
||||||
$scope.apiUrl = formatUrl($scope.apiUrl);
|
$scope.apiUrl = formatUrl($scope.apiUrl);
|
||||||
$window.localStorage.setItem(constantsService.apiUrlKey, $scope.apiUrl);
|
$window.localStorage.setItem(constantsService.apiUrlKey, $scope.apiUrl);
|
||||||
|
|
|
@ -30,6 +30,10 @@
|
||||||
{{i18n.customEnvironment}}
|
{{i18n.customEnvironment}}
|
||||||
</div>
|
</div>
|
||||||
<div class="list-section-items">
|
<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">
|
<div class="list-section-item">
|
||||||
<label for="apiUrl" class="item-label">{{i18n.apiUrl}}</label>
|
<label for="apiUrl" class="item-label">{{i18n.apiUrl}}</label>
|
||||||
<input id="apiUrl" type="text" name="ApiUrl" ng-model="apiUrl">
|
<input id="apiUrl" type="text" name="ApiUrl" ng-model="apiUrl">
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
function U2f(successCallback, errorCallback, infoCallback) {
|
function U2f(webVaultUrl, successCallback, errorCallback, infoCallback) {
|
||||||
this.success = successCallback;
|
this.success = successCallback;
|
||||||
this.error = errorCallback;
|
this.error = errorCallback;
|
||||||
this.info = infoCallback;
|
this.info = infoCallback;
|
||||||
this.iframe = null;
|
this.iframe = null;
|
||||||
this.connectorLink = document.createElement('a');
|
this.connectorLink = document.createElement('a');
|
||||||
|
this.webVaultUrl = webVaultUrl && webVaultUrl !== '' ? webVaultUrl : 'https://vault.bitwarden.com';
|
||||||
}
|
}
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
|
@ -12,7 +13,7 @@
|
||||||
U2f.prototype.init = function (data) {
|
U2f.prototype.init = function (data) {
|
||||||
var self = thisU2f = this;
|
var self = thisU2f = this;
|
||||||
|
|
||||||
self.connectorLink.href = 'https://vault.bitwarden.com/u2f-connector.html' +
|
self.connectorLink.href = self.webVaultUrl + '/u2f-connector.html' +
|
||||||
'?data=' + this.base64Encode(JSON.stringify(data)) +
|
'?data=' + this.base64Encode(JSON.stringify(data)) +
|
||||||
'&parent=' + encodeURIComponent(document.location.href) +
|
'&parent=' + encodeURIComponent(document.location.href) +
|
||||||
'&v=1';
|
'&v=1';
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
function ConstantsService(i18nService) {
|
function ConstantsService(i18nService) {
|
||||||
return {
|
return {
|
||||||
baseUrlKey: 'baseUrl',
|
baseUrlKey: 'baseUrl',
|
||||||
|
webVaultUrlKey: 'webVaultUrl',
|
||||||
apiUrlKey: 'apiUrl',
|
apiUrlKey: 'apiUrl',
|
||||||
identityUrlKey: 'identityUrl',
|
identityUrlKey: 'identityUrl',
|
||||||
disableGaKey: 'disableGa',
|
disableGaKey: 'disableGa',
|
||||||
|
|
Loading…
Reference in New Issue