mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00:00
prevent double MP prompt on copy and delete (#15218)
This commit is contained in:
@@ -25,6 +25,7 @@ export class ItemFooterComponent implements OnInit {
|
|||||||
@Input() collectionId: string | null = null;
|
@Input() collectionId: string | null = null;
|
||||||
@Input({ required: true }) action: string = "view";
|
@Input({ required: true }) action: string = "view";
|
||||||
@Input() isSubmitting: boolean = false;
|
@Input() isSubmitting: boolean = false;
|
||||||
|
@Input() masterPasswordAlreadyPrompted: boolean = false;
|
||||||
@Output() onEdit = new EventEmitter<CipherView>();
|
@Output() onEdit = new EventEmitter<CipherView>();
|
||||||
@Output() onClone = new EventEmitter<CipherView>();
|
@Output() onClone = new EventEmitter<CipherView>();
|
||||||
@Output() onDelete = new EventEmitter<CipherView>();
|
@Output() onDelete = new EventEmitter<CipherView>();
|
||||||
@@ -34,8 +35,7 @@ export class ItemFooterComponent implements OnInit {
|
|||||||
|
|
||||||
canDeleteCipher$: Observable<boolean> = new Observable();
|
canDeleteCipher$: Observable<boolean> = new Observable();
|
||||||
activeUserId: UserId | null = null;
|
activeUserId: UserId | null = null;
|
||||||
|
passwordReprompted: boolean = false;
|
||||||
private passwordReprompted = false;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected cipherService: CipherService,
|
protected cipherService: CipherService,
|
||||||
@@ -51,6 +51,7 @@ export class ItemFooterComponent implements OnInit {
|
|||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.canDeleteCipher$ = this.cipherAuthorizationService.canDeleteCipher$(this.cipher);
|
this.canDeleteCipher$ = this.cipherAuthorizationService.canDeleteCipher$(this.cipher);
|
||||||
this.activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId));
|
this.activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId));
|
||||||
|
this.passwordReprompted = this.masterPasswordAlreadyPrompted;
|
||||||
}
|
}
|
||||||
|
|
||||||
async clone() {
|
async clone() {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
(onDelete)="deleteCipher()"
|
(onDelete)="deleteCipher()"
|
||||||
(onCancel)="cancelCipher($event)"
|
(onCancel)="cancelCipher($event)"
|
||||||
[isSubmitting]="isSubmitting"
|
[isSubmitting]="isSubmitting"
|
||||||
|
[masterPasswordAlreadyPrompted]="cipherRepromptId === cipherId"
|
||||||
></app-vault-item-footer>
|
></app-vault-item-footer>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="inner-content">
|
<div class="inner-content">
|
||||||
|
|||||||
@@ -744,10 +744,17 @@ export class VaultV2Component implements OnInit, OnDestroy, CopyClickListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async editFolder(folderId: string) {
|
async editFolder(folderId: string) {
|
||||||
|
if (!this.activeUserId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const folderView = await firstValueFrom(
|
const folderView = await firstValueFrom(
|
||||||
this.folderService.getDecrypted$(folderId, this.activeUserId),
|
this.folderService.getDecrypted$(folderId, this.activeUserId),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!folderView) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const dialogRef = AddEditFolderDialogComponent.open(this.dialogService, {
|
const dialogRef = AddEditFolderDialogComponent.open(this.dialogService, {
|
||||||
editFolderConfig: {
|
editFolderConfig: {
|
||||||
folder: {
|
folder: {
|
||||||
@@ -762,7 +769,7 @@ export class VaultV2Component implements OnInit, OnDestroy, CopyClickListener {
|
|||||||
result === AddEditFolderDialogResult.Deleted ||
|
result === AddEditFolderDialogResult.Deleted ||
|
||||||
result === AddEditFolderDialogResult.Created
|
result === AddEditFolderDialogResult.Created
|
||||||
) {
|
) {
|
||||||
await this.vaultFilterComponent.reloadCollectionsAndFolders(this.activeFilter);
|
await this.vaultFilterComponent?.reloadCollectionsAndFolders(this.activeFilter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -807,10 +814,6 @@ export class VaultV2Component implements OnInit, OnDestroy, CopyClickListener {
|
|||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
private addCipherWithChangeDetection(type: CipherType) {
|
|
||||||
this.functionWithChangeDetection(() => this.addCipher(type).catch(() => {}));
|
|
||||||
}
|
|
||||||
|
|
||||||
private copyValue(cipher: CipherView, value: string, labelI18nKey: string, aType: string) {
|
private copyValue(cipher: CipherView, value: string, labelI18nKey: string, aType: string) {
|
||||||
this.functionWithChangeDetection(() => {
|
this.functionWithChangeDetection(() => {
|
||||||
(async () => {
|
(async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user