From d448c402dc70dd18ffeaa3c88410a508099559b9 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Fri, 5 Nov 2021 14:18:59 +0100 Subject: [PATCH 1/2] Filter ciphers that have password reprompt set when using unlock on autofill via contextMenu --- src/background/contextMenus.background.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/background/contextMenus.background.ts b/src/background/contextMenus.background.ts index 9a29294d4f..f556ae2bff 100644 --- a/src/background/contextMenus.background.ts +++ b/src/background/contextMenus.background.ts @@ -9,6 +9,7 @@ import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.se import { TotpService } from 'jslib-common/abstractions/totp.service'; import { VaultTimeoutService } from 'jslib-common/abstractions/vaultTimeout.service'; +import { CipherRepromptType } from 'jslib-common/enums/cipherRepromptType'; import { EventType } from 'jslib-common/enums/eventType'; import { CipherView } from 'jslib-common/models/view/cipherView'; import LockedVaultPendingNotificationsItem from './models/lockedVaultPendingNotificationsItem'; @@ -84,7 +85,7 @@ export default class ContextMenusBackground { let cipher: CipherView; if (id === this.noopCommandSuffix) { const ciphers = await this.cipherService.getAllDecryptedForUrl(tab.url); - cipher = ciphers.length > 0 ? ciphers[0] : null; + cipher = ciphers.find(x => x.reprompt === CipherRepromptType.None); } else { const ciphers = await this.cipherService.getAllDecrypted(); cipher = ciphers.find(c => c.id === id); From f3ed0329a870408144d94e07326467e0efe5d0fd Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Tue, 9 Nov 2021 09:43:11 +0100 Subject: [PATCH 2/2] Changed param of arrow function for check of CipherRepromptType --- src/background/contextMenus.background.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/background/contextMenus.background.ts b/src/background/contextMenus.background.ts index f556ae2bff..6852669dc4 100644 --- a/src/background/contextMenus.background.ts +++ b/src/background/contextMenus.background.ts @@ -85,7 +85,7 @@ export default class ContextMenusBackground { let cipher: CipherView; if (id === this.noopCommandSuffix) { const ciphers = await this.cipherService.getAllDecryptedForUrl(tab.url); - cipher = ciphers.find(x => x.reprompt === CipherRepromptType.None); + cipher = ciphers.find(c => c.reprompt === CipherRepromptType.None); } else { const ciphers = await this.cipherService.getAllDecrypted(); cipher = ciphers.find(c => c.id === id);