1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 08:43:33 +00:00

feat: Add option to auto-copy TOTP code when page auto fills credentials

This commit is contained in:
Tomer Shvueli
2021-02-20 14:48:54 -05:00
parent 8d2e436a05
commit 72d0a439d2
4 changed files with 36 additions and 1 deletions

View File

@@ -23,6 +23,7 @@ import { ConstantsService } from 'jslib/services/constants.service';
export class OptionsComponent implements OnInit {
disableFavicon = false;
enableAutoFillOnPageLoad = false;
enableAutoTotpCopyOnAutoFill = false;
disableAutoTotpCopy = false;
disableContextMenuItem = false;
disableAddLoginNotification = false;
@@ -70,6 +71,8 @@ export class OptionsComponent implements OnInit {
this.enableAutoFillOnPageLoad = await this.storageService.get<boolean>(
ConstantsService.enableAutoFillOnPageLoadKey);
this.enableAutoTotpCopyOnAutoFill = await this.totpService.isAutoCopyOnAutoFillEnabled();
this.disableAddLoginNotification = await this.storageService.get<boolean>(
ConstantsService.disableAddLoginNotificationKey);
@@ -120,9 +123,20 @@ export class OptionsComponent implements OnInit {
async updateAutoFillOnPageLoad() {
await this.storageService.save(ConstantsService.enableAutoFillOnPageLoadKey, this.enableAutoFillOnPageLoad);
if (!this.enableAutoFillOnPageLoad) {
// If we disable Auto Fill on Page Load, also disable Copying of TOTP
await this.storageService.save(ConstantsService.enableAutoTotpCopyOnAutoFill, false);
// TODO the below reloads the entire extension, I just want to reload the current view, or at least the enable auto totp copy checkbox
window.setTimeout(() => window.location.reload(), 200);
}
this.callAnalytics('Auto-fill Page Load', this.enableAutoFillOnPageLoad);
}
async updateAutoTotpCopyOnAutoFill() {
await this.storageService.save(ConstantsService.enableAutoTotpCopyOnAutoFill, this.enableAutoTotpCopyOnAutoFill);
this.callAnalytics('Auto Copy TOTP on Page Load', this.enableAutoTotpCopyOnAutoFill);
}
async updateDisableFavicon() {
await this.storageService.save(ConstantsService.disableFaviconKey, this.disableFavicon);
await this.stateService.save(ConstantsService.disableFaviconKey, this.disableFavicon);