1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-27 17:18:04 +01:00

add option to disable website icons in web vault

This commit is contained in:
Kyle Spearrin 2017-10-23 16:06:55 -04:00
parent d53187935b
commit 52a4317d09
3 changed files with 41 additions and 7 deletions

View File

@ -1,8 +1,10 @@
angular
.module('bit.services')
.factory('cipherService', function (cryptoService, apiService, $q, $window, constants, appSettings) {
var _service = {};
.factory('cipherService', function (cryptoService, apiService, $q, $window, constants, appSettings, $localStorage) {
var _service = {
disableWebsiteIcons: $localStorage.disableWebsiteIcons
};
_service.decryptCiphers = function (encryptedCiphers) {
if (!encryptedCiphers) throw "encryptedCiphers is undefined or null";
@ -187,7 +189,7 @@ angular
};
function setLoginIcon(cipher, uri, setImage) {
if (!appSettings.selfHosted && uri) {
if (!appSettings.selfHosted && !_service.disableWebsiteIcons && uri) {
var hostnameUri = uri,
isWebsite = false;

View File

@ -1,11 +1,13 @@
angular
.module('bit.settings')
.controller('settingsController', function ($scope, $state, $uibModal, apiService, toastr, authService) {
.controller('settingsController', function ($scope, $state, $uibModal, apiService, toastr, authService, $localStorage,
appSettings, $rootScope, cipherService) {
$scope.selfHosted = appSettings.selfHosted;
$scope.model = {
profile: {},
twoFactorEnabled: false,
email: null
email: null,
disableWebsiteIcons: false
};
$scope.$on('$viewContentLoaded', function () {
@ -17,7 +19,7 @@
culture: user.Culture
},
email: user.Email,
twoFactorEnabled: user.TwoFactorEnabled
disableWebsiteIcons: $localStorage.disableWebsiteIcons
};
if (user.Organizations) {
@ -58,6 +60,15 @@
}).$promise;
};
$scope.optionsSave = function () {
if (!$scope.selfHosted) {
$localStorage.disableWebsiteIcons = cipherService.disableWebsiteIcons = $scope.model.disableWebsiteIcons;
$rootScope.vaultCiphers = null;
}
toastr.success('Options have been updated.', 'Success!');
};
$scope.changePassword = function () {
$uibModal.open({
animation: true,

View File

@ -86,6 +86,27 @@
</div>
</form>
</div>
<div class="box box-default" ng-if="!selfHosted">
<div class="box-header with-border">
<h3 class="box-title">Options</h3>
</div>
<form role="form" name="optionsForm" ng-submit="optionsForm.$valid && optionsSave()" autocomplete="off">
<div class="box-body">
<div class="checkbox">
<label>
<input type="checkbox" ng-model="model.disableWebsiteIcons">
Disable Website Icons
</label>
<p class="help-block">Website Icons provide a recognizable image next to each login item in your vault.</p>
</div>
</div>
<div class="box-footer">
<button type="submit" class="btn btn-primary btn-flat" ng-disabled="optionsForm.$loading">
<i class="fa fa-refresh fa-spin loading-icon" ng-show="optionsForm.$loading"></i>Save
</button>
</div>
</form>
</div>
<div class="box box-default">
<div class="box-header with-border">
<h3 class="box-title">Organizations</h3>