From 993f37fbae3b7b011c0fe7235398a1ef85eba5c7 Mon Sep 17 00:00:00 2001 From: Jared Snider <116684653+JaredSnider-Bitwarden@users.noreply.github.com> Date: Tue, 15 Aug 2023 11:35:01 -0400 Subject: [PATCH] PM-3451 - Update password reprompt logic checks to ensure we have an existing cipher in the add/edit flows to avoid showing the MP reprompt in new cipher scenarios (#6031) --- .../src/app/vault/individual-vault/vault.component.ts | 9 ++++++++- apps/web/src/app/vault/org-vault/vault.component.ts | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/apps/web/src/app/vault/individual-vault/vault.component.ts b/apps/web/src/app/vault/individual-vault/vault.component.ts index 70149cc002..ba32a27aed 100644 --- a/apps/web/src/app/vault/individual-vault/vault.component.ts +++ b/apps/web/src/app/vault/individual-vault/vault.component.ts @@ -604,7 +604,14 @@ export class VaultComponent implements OnInit, OnDestroy { async editCipherId(id: string) { const cipher = await this.cipherService.get(id); - if (cipher?.reprompt !== 0 && !(await this.passwordRepromptService.showPasswordPrompt())) { + // if cipher exists (cipher is null when new) and MP reprompt + // is on for this cipher, then show password reprompt + if ( + cipher && + cipher.reprompt !== 0 && + !(await this.passwordRepromptService.showPasswordPrompt()) + ) { + // didn't pass password prompt, so don't open add / edit modal this.go({ cipherId: null, itemId: null }); return; } diff --git a/apps/web/src/app/vault/org-vault/vault.component.ts b/apps/web/src/app/vault/org-vault/vault.component.ts index 8370b78cdc..cfeafbf032 100644 --- a/apps/web/src/app/vault/org-vault/vault.component.ts +++ b/apps/web/src/app/vault/org-vault/vault.component.ts @@ -600,7 +600,14 @@ export class VaultComponent implements OnInit, OnDestroy { additionalComponentParameters?: (comp: AddEditComponent) => void ) { const cipher = await this.cipherService.get(cipherId); - if (cipher?.reprompt !== 0 && !(await this.passwordRepromptService.showPasswordPrompt())) { + // if cipher exists (cipher is null when new) and MP reprompt + // is on for this cipher, then show password reprompt + if ( + cipher && + cipher.reprompt !== 0 && + !(await this.passwordRepromptService.showPasswordPrompt()) + ) { + // didn't pass password prompt, so don't open add / edit modal this.go({ cipherId: null, itemId: null }); return; }