1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 16:23:44 +00:00

added option to disable auto totp copying

This commit is contained in:
Kyle Spearrin
2017-07-21 10:54:41 -04:00
parent 592b14149f
commit a6ee05ef93
7 changed files with 125 additions and 38 deletions

View File

@@ -1,45 +1,52 @@
angular
.module('bit.settings')
.controller('settingsFeaturesController', function ($scope, i18nService, $analytics, constantsService, utilsService) {
.controller('settingsFeaturesController', function ($scope, i18nService, $analytics, constantsService, utilsService,
totpService, $timeout) {
$scope.i18n = i18nService;
$scope.disableGa = false;
$scope.disableAddLoginNotification = false;
$scope.disableContextMenuItem = false;
chrome.storage.local.get(constantsService.disableGaKey, function (obj) {
// Default for Firefox is disabled.
if ((utilsService.isFirefox() && obj[constantsService.disableGaKey] === undefined) ||
obj[constantsService.disableGaKey]) {
$scope.disableGa = true;
}
else {
$scope.disableGa = false;
}
$scope.$apply();
$timeout(function () {
// Default for Firefox is disabled.
if ((utilsService.isFirefox() && obj[constantsService.disableGaKey] === undefined) ||
obj[constantsService.disableGaKey]) {
$scope.disableGa = true;
}
else {
$scope.disableGa = false;
}
});
});
chrome.storage.local.get(constantsService.disableAddLoginNotificationKey, function (obj) {
if (obj && obj[constantsService.disableAddLoginNotificationKey]) {
$scope.disableAddLoginNotification = true;
}
else {
$scope.disableAddLoginNotification = false;
}
$scope.$apply();
$timeout(function () {
if (obj && obj[constantsService.disableAddLoginNotificationKey]) {
$scope.disableAddLoginNotification = true;
}
else {
$scope.disableAddLoginNotification = false;
}
});
});
chrome.storage.local.get(constantsService.disableContextMenuItemKey, function (obj) {
if (obj && obj[constantsService.disableContextMenuItemKey]) {
$scope.disableContextMenuItem = true;
}
else {
$scope.disableContextMenuItem = false;
}
$timeout(function () {
if (obj && obj[constantsService.disableContextMenuItemKey]) {
$scope.disableContextMenuItem = true;
}
else {
$scope.disableContextMenuItem = false;
}
});
});
$scope.$apply();
totpService.isAutoCopyEnabled().then(function (enabled) {
$timeout(function () {
$scope.disableAutoTotpCopy = !enabled;
});
});
$scope.updateGa = function () {
@@ -57,8 +64,9 @@
}
chrome.storage.local.set(obj, function () {
$scope.disableGa = obj[constantsService.disableGaKey];
$scope.$apply();
$timeout(function () {
$scope.disableGa = obj[constantsService.disableGaKey];
});
if (!obj[constantsService.disableGaKey]) {
$analytics.eventTrack('Enabled Analytics');
}
@@ -79,8 +87,9 @@
}
chrome.storage.local.set(obj, function () {
$scope.disableAddLoginNotification = obj[constantsService.disableAddLoginNotificationKey];
$scope.$apply();
$timeout(function () {
$scope.disableAddLoginNotification = obj[constantsService.disableAddLoginNotificationKey];
});
if (!obj[constantsService.disableAddLoginNotificationKey]) {
$analytics.eventTrack('Enabled Add Login Notification');
}
@@ -101,8 +110,9 @@
}
chrome.storage.local.set(obj, function () {
$scope.disableContextMenuItem = obj[constantsService.disableContextMenuItemKey];
$scope.$apply();
$timeout(function () {
$scope.disableContextMenuItem = obj[constantsService.disableContextMenuItemKey];
});
if (!obj[constantsService.disableContextMenuItemKey]) {
$analytics.eventTrack('Enabled Context Menu Item');
}
@@ -112,4 +122,27 @@
});
});
};
$scope.updateAutoTotpCopy = function () {
chrome.storage.local.get(constantsService.disableAutoTotpCopyKey, function (obj) {
if (obj[constantsService.disableAutoTotpCopyKey]) {
// enable
obj[constantsService.disableAutoTotpCopyKey] = false;
}
else {
// disable
$analytics.eventTrack('Disabled Auto Copy TOTP');
obj[constantsService.disableAutoTotpCopyKey] = true;
}
chrome.storage.local.set(obj, function () {
$timeout(function () {
$scope.disableAutoTotpCopy = obj[constantsService.disableAutoTotpCopyKey];
});
if (!obj[constantsService.disableAutoTotpCopyKey]) {
$analytics.eventTrack('Enabled Auto Copy TOTP');
}
});
});
};
});