diff --git a/apps/desktop/src/vault/app/vault/vault.component.html b/apps/desktop/src/vault/app/vault/vault.component.html index 1879573a843..99131a848cc 100644 --- a/apps/desktop/src/vault/app/vault/vault.component.html +++ b/apps/desktop/src/vault/app/vault/vault.component.html @@ -16,7 +16,7 @@ [cipherId]="cipherId" [collectionId]="activeFilter?.selectedCollectionId" (onCloneCipher)="cloneCipherWithoutPasswordPrompt($event)" - (onEditCipher)="editCipherWithoutPasswordPrompt($event)" + (onEditCipher)="editCipher($event)" (onViewCipherPasswordHistory)="viewCipherPasswordHistory($event)" (onRestoredCipher)="restoredCipher($event)" (onDeletedCipher)="deletedCipher($event)" diff --git a/apps/desktop/src/vault/app/vault/vault.component.ts b/apps/desktop/src/vault/app/vault/vault.component.ts index d8be360170a..a21a285a428 100644 --- a/apps/desktop/src/vault/app/vault/vault.component.ts +++ b/apps/desktop/src/vault/app/vault/vault.component.ts @@ -91,6 +91,7 @@ export class VaultComponent implements OnInit, OnDestroy { userHasPremiumAccess = false; activeFilter: VaultFilter = new VaultFilter(); activeUserId: UserId; + cipherRepromptId: string | null = null; private modal: ModalRef = null; private componentIsDestroyed$ = new Subject(); @@ -298,6 +299,8 @@ export class VaultComponent implements OnInit, OnDestroy { async viewCipher(cipher: CipherView) { if (!(await this.canNavigateAway("view", cipher))) { return; + } else if (!(await this.passwordReprompt(cipher))) { + return; } this.cipherId = cipher.id; @@ -766,9 +769,8 @@ export class VaultComponent implements OnInit, OnDestroy { private copyValue(cipher: CipherView, value: string, labelI18nKey: string, aType: string) { this.functionWithChangeDetection(async () => { if ( - cipher.reprompt !== CipherRepromptType.None && this.passwordRepromptService.protectedFields().includes(aType) && - !(await this.passwordRepromptService.showPasswordPrompt()) + !(await this.passwordReprompt(cipher)) ) { return; } @@ -821,9 +823,17 @@ export class VaultComponent implements OnInit, OnDestroy { } private async passwordReprompt(cipher: CipherView) { - return ( - cipher.reprompt === CipherRepromptType.None || - (await this.passwordRepromptService.showPasswordPrompt()) - ); + if (cipher.reprompt === CipherRepromptType.None) { + this.cipherRepromptId = null; + return true; + } + if (this.cipherRepromptId === cipher.id) { + return true; + } + const repromptResult = await this.passwordRepromptService.showPasswordPrompt(); + if (repromptResult) { + this.cipherRepromptId = cipher.id; + } + return repromptResult; } } diff --git a/libs/angular/src/vault/components/view.component.ts b/libs/angular/src/vault/components/view.component.ts index 0e980bf66d1..0dda3c593b7 100644 --- a/libs/angular/src/vault/components/view.component.ts +++ b/libs/angular/src/vault/components/view.component.ts @@ -205,12 +205,7 @@ export class ViewComponent implements OnDestroy, OnInit { } async edit() { - if (await this.promptPassword()) { - this.onEditCipher.emit(this.cipher); - return true; - } - - return false; + this.onEditCipher.emit(this.cipher); } async clone() {