mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-27 12:36:14 +01:00
added option to disable auto totp copying
This commit is contained in:
parent
592b14149f
commit
a6ee05ef93
@ -830,5 +830,13 @@
|
|||||||
"refreshComplete": {
|
"refreshComplete": {
|
||||||
"message": "Refresh complete",
|
"message": "Refresh complete",
|
||||||
"description": "Refresh complete"
|
"description": "Refresh complete"
|
||||||
|
},
|
||||||
|
"disableAutoTotpCopy": {
|
||||||
|
"message": "Disable Automatic TOTP Copy",
|
||||||
|
"description": "Disable Automatic TOTP Copy"
|
||||||
|
},
|
||||||
|
"disableAutoTotpCopyDesc": {
|
||||||
|
"message": "If your login has an authenticator key attached to it, the TOTP verification code is automatically copied to your clipboard whenever you auto-fill the login.",
|
||||||
|
"description": "If your login has an authenticator key attached to it, the TOTP verification code is automatically copied to your clipboard whenever you auto-fill the login."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ var bg_syncService = new SyncService(bg_loginService, bg_folderService, bg_userS
|
|||||||
bg_cryptoService, logout);
|
bg_cryptoService, logout);
|
||||||
var bg_autofillService = new AutofillService();
|
var bg_autofillService = new AutofillService();
|
||||||
var bg_passwordGenerationService = new PasswordGenerationService();
|
var bg_passwordGenerationService = new PasswordGenerationService();
|
||||||
var bg_totpService = new TotpService();
|
var bg_totpService = new TotpService(bg_constantsService);
|
||||||
|
|
||||||
if (chrome.commands) {
|
if (chrome.commands) {
|
||||||
chrome.commands.onCommand.addListener(function (command) {
|
chrome.commands.onCommand.addListener(function (command) {
|
||||||
@ -609,8 +609,17 @@ function autofillPage() {
|
|||||||
}, { frameId: pageDetailsToAutoFill[i].frameId });
|
}, { frameId: pageDetailsToAutoFill[i].frameId });
|
||||||
|
|
||||||
if (!bg_utilsService.isFirefox() && loginToAutoFill.totp && bg_tokenService.getPremium()) {
|
if (!bg_utilsService.isFirefox() && loginToAutoFill.totp && bg_tokenService.getPremium()) {
|
||||||
bg_totpService.getCode(loginToAutoFill.totp).then(function (code) {
|
var totpKey = loginToAutoFill.totp;
|
||||||
bg_utilsService.copyToClipboard(code);
|
bg_totpService.isAutoCopyEnabled().then(function (enabled) {
|
||||||
|
if (enabled) {
|
||||||
|
return bg_totpService.getCode(totpKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}).then(function (code) {
|
||||||
|
if (code) {
|
||||||
|
bg_utilsService.copyToClipboard(code);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,8 +86,16 @@ angular
|
|||||||
}, { frameId: pageDetails[i].frameId }, $window.close);
|
}, { frameId: pageDetails[i].frameId }, $window.close);
|
||||||
|
|
||||||
if (login.totp && tokenService.getPremium()) {
|
if (login.totp && tokenService.getPremium()) {
|
||||||
totpService.getCode(login.totp).then(function (code) {
|
totpService.isAutoCopyEnabled().then(function (enabled) {
|
||||||
utilsService.copyToClipboard(code);
|
if (enabled) {
|
||||||
|
return totpService.getCode(login.totp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}).then(function (code) {
|
||||||
|
if (code) {
|
||||||
|
utilsService.copyToClipboard(code);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,45 +1,52 @@
|
|||||||
angular
|
angular
|
||||||
.module('bit.settings')
|
.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.i18n = i18nService;
|
||||||
$scope.disableGa = false;
|
$scope.disableGa = false;
|
||||||
$scope.disableAddLoginNotification = false;
|
$scope.disableAddLoginNotification = false;
|
||||||
$scope.disableContextMenuItem = false;
|
$scope.disableContextMenuItem = false;
|
||||||
|
|
||||||
chrome.storage.local.get(constantsService.disableGaKey, function (obj) {
|
chrome.storage.local.get(constantsService.disableGaKey, function (obj) {
|
||||||
// Default for Firefox is disabled.
|
$timeout(function () {
|
||||||
if ((utilsService.isFirefox() && obj[constantsService.disableGaKey] === undefined) ||
|
// Default for Firefox is disabled.
|
||||||
obj[constantsService.disableGaKey]) {
|
if ((utilsService.isFirefox() && obj[constantsService.disableGaKey] === undefined) ||
|
||||||
$scope.disableGa = true;
|
obj[constantsService.disableGaKey]) {
|
||||||
}
|
$scope.disableGa = true;
|
||||||
else {
|
}
|
||||||
$scope.disableGa = false;
|
else {
|
||||||
}
|
$scope.disableGa = false;
|
||||||
|
}
|
||||||
$scope.$apply();
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
chrome.storage.local.get(constantsService.disableAddLoginNotificationKey, function (obj) {
|
chrome.storage.local.get(constantsService.disableAddLoginNotificationKey, function (obj) {
|
||||||
if (obj && obj[constantsService.disableAddLoginNotificationKey]) {
|
$timeout(function () {
|
||||||
$scope.disableAddLoginNotification = true;
|
if (obj && obj[constantsService.disableAddLoginNotificationKey]) {
|
||||||
}
|
$scope.disableAddLoginNotification = true;
|
||||||
else {
|
}
|
||||||
$scope.disableAddLoginNotification = false;
|
else {
|
||||||
}
|
$scope.disableAddLoginNotification = false;
|
||||||
|
}
|
||||||
$scope.$apply();
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
chrome.storage.local.get(constantsService.disableContextMenuItemKey, function (obj) {
|
chrome.storage.local.get(constantsService.disableContextMenuItemKey, function (obj) {
|
||||||
if (obj && obj[constantsService.disableContextMenuItemKey]) {
|
$timeout(function () {
|
||||||
$scope.disableContextMenuItem = true;
|
if (obj && obj[constantsService.disableContextMenuItemKey]) {
|
||||||
}
|
$scope.disableContextMenuItem = true;
|
||||||
else {
|
}
|
||||||
$scope.disableContextMenuItem = false;
|
else {
|
||||||
}
|
$scope.disableContextMenuItem = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
$scope.$apply();
|
totpService.isAutoCopyEnabled().then(function (enabled) {
|
||||||
|
$timeout(function () {
|
||||||
|
$scope.disableAutoTotpCopy = !enabled;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.updateGa = function () {
|
$scope.updateGa = function () {
|
||||||
@ -57,8 +64,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
chrome.storage.local.set(obj, function () {
|
chrome.storage.local.set(obj, function () {
|
||||||
$scope.disableGa = obj[constantsService.disableGaKey];
|
$timeout(function () {
|
||||||
$scope.$apply();
|
$scope.disableGa = obj[constantsService.disableGaKey];
|
||||||
|
});
|
||||||
if (!obj[constantsService.disableGaKey]) {
|
if (!obj[constantsService.disableGaKey]) {
|
||||||
$analytics.eventTrack('Enabled Analytics');
|
$analytics.eventTrack('Enabled Analytics');
|
||||||
}
|
}
|
||||||
@ -79,8 +87,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
chrome.storage.local.set(obj, function () {
|
chrome.storage.local.set(obj, function () {
|
||||||
$scope.disableAddLoginNotification = obj[constantsService.disableAddLoginNotificationKey];
|
$timeout(function () {
|
||||||
$scope.$apply();
|
$scope.disableAddLoginNotification = obj[constantsService.disableAddLoginNotificationKey];
|
||||||
|
});
|
||||||
if (!obj[constantsService.disableAddLoginNotificationKey]) {
|
if (!obj[constantsService.disableAddLoginNotificationKey]) {
|
||||||
$analytics.eventTrack('Enabled Add Login Notification');
|
$analytics.eventTrack('Enabled Add Login Notification');
|
||||||
}
|
}
|
||||||
@ -101,8 +110,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
chrome.storage.local.set(obj, function () {
|
chrome.storage.local.set(obj, function () {
|
||||||
$scope.disableContextMenuItem = obj[constantsService.disableContextMenuItemKey];
|
$timeout(function () {
|
||||||
$scope.$apply();
|
$scope.disableContextMenuItem = obj[constantsService.disableContextMenuItemKey];
|
||||||
|
});
|
||||||
if (!obj[constantsService.disableContextMenuItemKey]) {
|
if (!obj[constantsService.disableContextMenuItemKey]) {
|
||||||
$analytics.eventTrack('Enabled Context Menu Item');
|
$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');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
@ -6,6 +6,17 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="list">
|
<div class="list">
|
||||||
|
<div class="list-section">
|
||||||
|
<div class="list-section-items">
|
||||||
|
<div class="list-section-item list-section-item-checkbox">
|
||||||
|
<label for="totp-copy">{{i18n.disableAutoTotpCopy}}</label>
|
||||||
|
<input id="totp-copy" type="checkbox" ng-model="disableAutoTotpCopy" ng-change="updateAutoTotpCopy()">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="list-section-footer">
|
||||||
|
{{i18n.disableAutoTotpCopyDesc}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="list-section">
|
<div class="list-section">
|
||||||
<div class="list-section-items">
|
<div class="list-section-items">
|
||||||
<div class="list-section-item list-section-item-checkbox">
|
<div class="list-section-item list-section-item-checkbox">
|
||||||
|
@ -3,6 +3,7 @@ function ConstantsService() {
|
|||||||
disableGaKey: 'disableGa',
|
disableGaKey: 'disableGa',
|
||||||
disableAddLoginNotificationKey: 'disableAddLoginNotification',
|
disableAddLoginNotificationKey: 'disableAddLoginNotification',
|
||||||
disableContextMenuItemKey: 'disableContextMenuItem',
|
disableContextMenuItemKey: 'disableContextMenuItem',
|
||||||
|
disableAutoTotpCopyKey: 'disableAutoTotpCopy',
|
||||||
lockOptionKey: 'lockOption',
|
lockOptionKey: 'lockOption',
|
||||||
lastActiveKey: 'lastActive',
|
lastActiveKey: 'lastActive',
|
||||||
encType: {
|
encType: {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
function TotpService() {
|
function TotpService(constantsService) {
|
||||||
|
this.constantsService = constantsService;
|
||||||
initTotpService();
|
initTotpService();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,4 +106,20 @@ function initTotpService() {
|
|||||||
return otp;
|
return otp;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TotpService.prototype.isAutoCopyEnabled = function () {
|
||||||
|
var deferred = Q.defer();
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
chrome.storage.local.get(self.constantsService.disableAutoTotpCopyKey, function (obj) {
|
||||||
|
if (obj && !!obj[self.constantsService.disableAutoTotpCopyKey]) {
|
||||||
|
deferred.resolve(false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
deferred.resolve(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return deferred.promise;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user