1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

More options for copying TOTP values (#1130)

* Implement ability to copy TOTP values without needing to view the full record"

* Remove changes to popup as they will be addressed separately
This commit is contained in:
Matthew Knox
2020-03-04 02:40:06 +11:00
committed by GitHub
parent 8dea9daeea
commit ceb4f3771d
2 changed files with 32 additions and 4 deletions

View File

@@ -213,7 +213,7 @@ export default class MainBackground {
this.tabsBackground = new TabsBackground(this);
this.contextMenusBackground = new ContextMenusBackground(this, this.cipherService,
this.passwordGenerationService, this.analytics, this.platformUtilsService, this.lockService,
this.eventService);
this.eventService, this.totpService);
this.idleBackground = new IdleBackground(this.lockService, this.storageService, this.notificationsService);
this.webRequestBackground = new WebRequestBackground(this.platformUtilsService, this.cipherService,
this.lockService);
@@ -443,6 +443,14 @@ export default class MainBackground {
title: this.i18nService.t('copyPassword'),
});
await this.contextMenusCreate({
type: 'normal',
id: 'copy-totp',
parentId: 'root',
contexts: ['all'],
title: this.i18nService.t('copyVerificationCode'),
});
await this.contextMenusCreate({
type: 'separator',
parentId: 'root',
@@ -575,6 +583,16 @@ export default class MainBackground {
title: title,
});
}
if (cipher == null || (cipher.login.totp && cipher.login.totp !== '')) {
await this.contextMenusCreate({
type: 'normal',
id: 'copy-totp_' + idSuffix,
parentId: 'copy-totp',
contexts: ['all'],
title: title,
});
}
}
private cleanupNotificationQueue() {