1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 15:53:27 +00:00

environment settings

This commit is contained in:
Kyle Spearrin
2017-08-22 12:00:59 -04:00
parent 5b6bddccca
commit 220703a9d7
11 changed files with 235 additions and 59 deletions

View File

@@ -90,27 +90,27 @@
data: { authorize: true },
params: { animation: null }
})
.state('tabs.current', {
url: '/current',
templateUrl: 'app/current/views/current.html',
controller: 'currentController'
})
.state('tabs.vault', {
url: '/vault',
templateUrl: 'app/vault/views/vault.html',
controller: 'vaultController',
params: { syncOnLoad: false }
})
.state('tabs.settings', {
url: '/settings',
templateUrl: 'app/settings/views/settings.html',
controller: 'settingsController'
})
.state('tabs.tools', {
url: '/tools',
templateUrl: 'app/tools/views/tools.html',
controller: 'toolsController'
})
.state('tabs.current', {
url: '/current',
templateUrl: 'app/current/views/current.html',
controller: 'currentController'
})
.state('tabs.vault', {
url: '/vault',
templateUrl: 'app/vault/views/vault.html',
controller: 'vaultController',
params: { syncOnLoad: false }
})
.state('tabs.settings', {
url: '/settings',
templateUrl: 'app/settings/views/settings.html',
controller: 'settingsController'
})
.state('tabs.tools', {
url: '/tools',
templateUrl: 'app/tools/views/tools.html',
controller: 'toolsController'
})
.state('viewFolder', {
url: '/view-folder?folderId',
@@ -227,6 +227,13 @@
data: { authorize: true },
params: { animation: null }
})
.state('environment', {
url: '/environment',
templateUrl: 'app/settings/views/settingsEnvironment.html',
controller: 'settingsEnvironmentController',
data: { authorize: false },
params: { animation: null }
})
.state('lock', {
url: '/lock',
templateUrl: 'app/lock/views/lock.html',

View File

@@ -1,16 +1,17 @@
<div class="content">
<div class="home-page">
<img src="../../../../images/logo@3x.png" alt="bitwarden" />
<p>{{i18n.loginOrCreateNewAccount}}</p>
<div class="bottom-buttons">
<a class="btn btn-lg btn-primary btn-block" ui-sref="register({animation: 'in-slide-up'})"
analytics-on="click" analytics-event="Clicked Create Account">
<b>{{i18n.createAccount}}</b>
</a>
<a class="btn btn-lg btn-link btn-block" ui-sref="login({animation: 'in-slide-up'})"
analytics-on="click" analytics-event="Clicked Log In">
{{i18n.login}}
</a>
</div>
<div class="home-page">
<a ui-sref="environment({animation: 'in-slide-up'})" class="settings-icon">
<i class="fa fa-cog fa-lg"></i><span> Settings</span>
</a>
<img src="../../../../images/logo@2x.png" alt="bitwarden" />
<p>{{i18n.loginOrCreateNewAccount}}</p>
<div class="bottom-buttons">
<a class="btn btn-lg btn-primary btn-block" ui-sref="register({animation: 'in-slide-up'})"
analytics-on="click" analytics-event="Clicked Create Account">
<b>{{i18n.createAccount}}</b>
</a>
<a class="btn btn-lg btn-link btn-block" ui-sref="login({animation: 'in-slide-up'})"
analytics-on="click" analytics-event="Clicked Log In">
{{i18n.login}}
</a>
</div>
</div>

View File

@@ -0,0 +1,51 @@
angular
.module('bit.settings')
.controller('settingsEnvironmentController', function ($scope, i18nService, $analytics, constantsService, utilsService,
$window, apiService, toastr) {
$scope.i18n = i18nService;
utilsService.initListSectionItemListeners($(document), angular);
$scope.baseUrl = $window.localStorage.getItem(constantsService.baseUrlKey) || '';
$scope.apiUrl = $window.localStorage.getItem(constantsService.apiUrlKey) || '';
$scope.identityUrl = $window.localStorage.getItem(constantsService.identityUrlKey) || '';
$scope.save = function () {
if ($scope.baseUrl && $scope.baseUrl !== '') {
$scope.baseUrl = formatUrl($scope.baseUrl);
$window.localStorage.setItem(constantsService.baseUrlKey, $scope.baseUrl);
}
else {
$window.localStorage.removeItem(constantsService.baseUrlKey);
}
if ($scope.apiUrl && $scope.apiUrl !== '') {
$scope.apiUrl = formatUrl($scope.apiUrl);
$window.localStorage.setItem(constantsService.apiUrlKey, $scope.apiUrl);
}
else {
$window.localStorage.removeItem(constantsService.apiUrlKey);
}
if ($scope.identityUrl && $scope.identityUrl !== '') {
$scope.identityUrl = formatUrl($scope.identityUrl);
$window.localStorage.setItem(constantsService.identityUrlKey, $scope.identityUrl);
}
else {
$window.localStorage.removeItem(constantsService.identityUrlKey);
}
apiService.setUrls();
$analytics.eventTrack('Set Environment URLs');
toastr.success(i18nService.environmentSaved);
};
function formatUrl(url) {
url = url.replace(/\/+$/g, '');
if (!url.startsWith("http://") && !url.startsWith('https://')) {
url = 'https://' + url;
}
return url;
}
});

View File

@@ -0,0 +1,48 @@
<form name="theForm" ng-submit="save()">
<div class="header">
<div class="left">
<a ui-sref="home({animation: 'out-slide-down'})">{{i18n.close}}</a>
</div>
<div class="right">
<button type="submit" class="btn btn-link">{{i18n.save}}</button>
</div>
<div class="title">{{i18n.settings}}</div>
</div>
<div class="content">
<div class="list">
<div class="list-section">
<div class="list-section-header">
{{i18n.selfHostedEnvironment}}
</div>
<div class="list-section-items">
<div class="list-section-item">
<label for="baseUrl" class="item-label">{{i18n.baseUrl}}</label>
<input id="baseUrl" type="text" name="BaseUrl" ng-model="baseUrl"
placeholder="ex. https://bitwarden.company.com">
</div>
</div>
<div class="list-section-footer">
{{i18n.selfHostedEnvironmentFooter}}
</div>
</div>
<div class="list-section">
<div class="list-section-header">
{{i18n.customEnvironment}}
</div>
<div class="list-section-items">
<div class="list-section-item">
<label for="apiUrl" class="item-label">{{i18n.apiUrl}}</label>
<input id="apiUrl" type="text" name="ApiUrl" ng-model="apiUrl">
</div>
<div class="list-section-item">
<label for="identityUrl" class="item-label">{{i18n.identityUrl}}</label>
<input id="identityUrl" type="text" name="IdentityUrl" ng-model="identityUrl">
</div>
</div>
<div class="list-section-footer">
{{i18n.customEnvironmentFooter}}
</div>
</div>
</div>
</div>
</form>

View File

@@ -85,6 +85,7 @@
<script src="app/settings/settingsAddFolderController.js"></script>
<script src="app/settings/settingsEditFolderController.js"></script>
<script src="app/settings/settingsPremiumController.js"></script>
<script src="app/settings/settingsEnvironmentController.js"></script>
<script src="app/tools/toolsModule.js"></script>
<script src="app/tools/toolsController.js"></script>

View File

@@ -375,6 +375,7 @@
border: none;
width: 100%;
background-color: transparent;
.placeholder-color(#bbbbbb);
&:focus {
outline: none;

View File

@@ -17,13 +17,13 @@
img {
margin: 0 auto 20px;
width: 220px;
width: 270px;
display: block;
}
}
.home-page {
padding: 100px 20px 20px;
padding: 150px 20px 20px;
text-align: center;
position: relative;
height: 100%;
@@ -37,6 +37,26 @@
p {
font-size: 18px;
}
a.settings-icon {
color: #bbbbbb;
position: absolute;
top: 10px;
left: 10px;
span {
visibility: hidden;
}
&:hover {
color: @link-hover-color;
text-decoration: none;
span {
visibility: visible;
}
}
}
}
.splash-page {