diff --git a/apps/browser/src/vault/popup/components/vault-v2/item-more-options/item-more-options.component.html b/apps/browser/src/vault/popup/components/vault-v2/item-more-options/item-more-options.component.html index d17269303e..8374bb0cc7 100644 --- a/apps/browser/src/vault/popup/components/vault-v2/item-more-options/item-more-options.component.html +++ b/apps/browser/src/vault/popup/components/vault-v2/item-more-options/item-more-options.component.html @@ -25,7 +25,7 @@ {{ favoriteText | i18n }} - + {{ "clone" | i18n }} diff --git a/apps/browser/src/vault/popup/components/vault-v2/item-more-options/item-more-options.component.ts b/apps/browser/src/vault/popup/components/vault-v2/item-more-options/item-more-options.component.ts index 4857703d3b..0291d6e872 100644 --- a/apps/browser/src/vault/popup/components/vault-v2/item-more-options/item-more-options.component.ts +++ b/apps/browser/src/vault/popup/components/vault-v2/item-more-options/item-more-options.component.ts @@ -76,6 +76,13 @@ export class ItemMoreOptionsComponent { } async doAutofillAndSave() { + if ( + this.cipher.reprompt === CipherRepromptType.Password && + !(await this.passwordRepromptService.showPasswordPrompt()) + ) { + return; + } + await this.vaultPopupAutofillService.doAutofillAndSave(this.cipher); } diff --git a/apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.html b/apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.html index b440a29ff7..f6e815dd46 100644 --- a/apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.html +++ b/apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.html @@ -20,8 +20,7 @@ diff --git a/apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.ts b/apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.ts index 8e3f2bca26..0f5287af34 100644 --- a/apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.ts +++ b/apps/browser/src/vault/popup/components/vault-v2/vault-list-items-container/vault-list-items-container.component.ts @@ -1,6 +1,6 @@ import { CommonModule } from "@angular/common"; import { booleanAttribute, Component, EventEmitter, Input, Output } from "@angular/core"; -import { RouterLink } from "@angular/router"; +import { Router, RouterLink } from "@angular/router"; import { JslibModule } from "@bitwarden/angular/jslib.module"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; @@ -13,7 +13,7 @@ import { SectionHeaderComponent, TypographyModule, } from "@bitwarden/components"; -import { OrgIconDirective } from "@bitwarden/vault"; +import { OrgIconDirective, PasswordRepromptService } from "@bitwarden/vault"; import { VaultPopupAutofillService } from "../../../services/vault-popup-autofill.service"; import { PopupCipherView } from "../../../views/popup-cipher.view"; @@ -100,9 +100,22 @@ export class VaultListItemsContainerComponent { constructor( private i18nService: I18nService, private vaultPopupAutofillService: VaultPopupAutofillService, + private passwordRepromptService: PasswordRepromptService, + private router: Router, ) {} async doAutofill(cipher: PopupCipherView) { await this.vaultPopupAutofillService.doAutofill(cipher); } + + async onViewCipher(cipher: PopupCipherView) { + const repromptPassed = await this.passwordRepromptService.passwordRepromptCheck(cipher); + if (!repromptPassed) { + return; + } + + await this.router.navigate(["/view-cipher"], { + queryParams: { cipherId: cipher.id, type: cipher.type }, + }); + } } diff --git a/apps/browser/src/vault/popup/components/vault-v2/view-v2/view-v2.component.ts b/apps/browser/src/vault/popup/components/vault-v2/view-v2/view-v2.component.ts index 91922162f9..8fb3963831 100644 --- a/apps/browser/src/vault/popup/components/vault-v2/view-v2/view-v2.component.ts +++ b/apps/browser/src/vault/popup/components/vault-v2/view-v2/view-v2.component.ts @@ -22,7 +22,6 @@ import { DialogService, ToastService, } from "@bitwarden/components"; -import { PasswordRepromptService } from "@bitwarden/vault"; import { CipherViewComponent } from "../../../../../../../../libs/vault/src/cipher-view"; @@ -55,14 +54,12 @@ export class ViewV2Component { organization$: Observable; folder$: Observable; collections$: Observable; - private passwordReprompted = false; constructor( private route: ActivatedRoute, private router: Router, private i18nService: I18nService, private cipherService: CipherService, - private passwordRepromptService: PasswordRepromptService, private dialogService: DialogService, private logService: LogService, private toastService: ToastService, @@ -102,20 +99,7 @@ export class ViewV2Component { return await cipher.decrypt(await this.cipherService.getKeyForCipherKeyDecryption(cipher)); } - async checkForPasswordReprompt() { - this.passwordReprompted = - this.passwordReprompted || - (await this.passwordRepromptService.passwordRepromptCheck(this.cipher)); - if (!this.passwordReprompted) { - return false; - } - return true; - } - async editCipher() { - if (!(await this.checkForPasswordReprompt())) { - return; - } if (this.cipher.isDeleted) { return false; } @@ -126,10 +110,6 @@ export class ViewV2Component { } delete = async (): Promise => { - if (!(await this.checkForPasswordReprompt())) { - return; - } - const confirmed = await this.dialogService.openSimpleDialog({ title: { key: "deleteItem" }, content: { diff --git a/libs/vault/src/components/download-attachment/download-attachment.component.ts b/libs/vault/src/components/download-attachment/download-attachment.component.ts index 3e00207c00..b9d5f35dce 100644 --- a/libs/vault/src/components/download-attachment/download-attachment.component.ts +++ b/libs/vault/src/components/download-attachment/download-attachment.component.ts @@ -18,8 +18,6 @@ import { AttachmentView } from "@bitwarden/common/vault/models/view/attachment.v import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { AsyncActionsModule, IconButtonModule, ToastService } from "@bitwarden/components"; -import { PasswordRepromptService } from "../../services/password-reprompt.service"; - @Component({ standalone: true, selector: "app-download-attachment", @@ -39,8 +37,6 @@ export class DownloadAttachmentComponent { /** The organization key if the cipher is associated with one */ private orgKey: OrgKey | null = null; - private passwordReprompted = false; - constructor( private i18nService: I18nService, private apiService: ApiService, @@ -49,7 +45,6 @@ export class DownloadAttachmentComponent { private encryptService: EncryptService, private stateProvider: StateProvider, private cryptoService: CryptoService, - private passwordRepromptService: PasswordRepromptService, ) { this.stateProvider.activeUserId$ .pipe( @@ -65,15 +60,6 @@ export class DownloadAttachmentComponent { /** Download the attachment */ download = async () => { - if (this.checkPwReprompt) { - this.passwordReprompted = - this.passwordReprompted || - (await this.passwordRepromptService.passwordRepromptCheck(this.cipher)); - if (!this.passwordReprompted) { - return; - } - } - let url: string; try { diff --git a/libs/vault/src/services/copy-cipher-field.service.ts b/libs/vault/src/services/copy-cipher-field.service.ts index 9cd94f5ce6..372409b8e9 100644 --- a/libs/vault/src/services/copy-cipher-field.service.ts +++ b/libs/vault/src/services/copy-cipher-field.service.ts @@ -58,10 +58,10 @@ const CopyActions: Record = { protected: true, event: EventType.Cipher_ClientCopiedCardCode, }, - email: { typeI18nKey: "email", protected: false }, - phone: { typeI18nKey: "phone", protected: false }, - address: { typeI18nKey: "address", protected: false }, - secureNote: { typeI18nKey: "note", protected: false }, + email: { typeI18nKey: "email", protected: true }, + phone: { typeI18nKey: "phone", protected: true }, + address: { typeI18nKey: "address", protected: true }, + secureNote: { typeI18nKey: "note", protected: true }, hiddenField: { typeI18nKey: "value", protected: true,