mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 13:53:34 +00:00
[PM-432] - Protect entire item when Master Password Re-prompt is selected - desktop (#14035)
* prompt for MP on cipher view * only keep reprompt while cipher is open * reset cipher password prompt after opening another cipher
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
[cipherId]="cipherId"
|
[cipherId]="cipherId"
|
||||||
[collectionId]="activeFilter?.selectedCollectionId"
|
[collectionId]="activeFilter?.selectedCollectionId"
|
||||||
(onCloneCipher)="cloneCipherWithoutPasswordPrompt($event)"
|
(onCloneCipher)="cloneCipherWithoutPasswordPrompt($event)"
|
||||||
(onEditCipher)="editCipherWithoutPasswordPrompt($event)"
|
(onEditCipher)="editCipher($event)"
|
||||||
(onViewCipherPasswordHistory)="viewCipherPasswordHistory($event)"
|
(onViewCipherPasswordHistory)="viewCipherPasswordHistory($event)"
|
||||||
(onRestoredCipher)="restoredCipher($event)"
|
(onRestoredCipher)="restoredCipher($event)"
|
||||||
(onDeletedCipher)="deletedCipher($event)"
|
(onDeletedCipher)="deletedCipher($event)"
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
userHasPremiumAccess = false;
|
userHasPremiumAccess = false;
|
||||||
activeFilter: VaultFilter = new VaultFilter();
|
activeFilter: VaultFilter = new VaultFilter();
|
||||||
activeUserId: UserId;
|
activeUserId: UserId;
|
||||||
|
cipherRepromptId: string | null = null;
|
||||||
|
|
||||||
private modal: ModalRef = null;
|
private modal: ModalRef = null;
|
||||||
private componentIsDestroyed$ = new Subject<boolean>();
|
private componentIsDestroyed$ = new Subject<boolean>();
|
||||||
@@ -298,6 +299,8 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
async viewCipher(cipher: CipherView) {
|
async viewCipher(cipher: CipherView) {
|
||||||
if (!(await this.canNavigateAway("view", cipher))) {
|
if (!(await this.canNavigateAway("view", cipher))) {
|
||||||
return;
|
return;
|
||||||
|
} else if (!(await this.passwordReprompt(cipher))) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.cipherId = cipher.id;
|
this.cipherId = cipher.id;
|
||||||
@@ -766,9 +769,8 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
private copyValue(cipher: CipherView, value: string, labelI18nKey: string, aType: string) {
|
private copyValue(cipher: CipherView, value: string, labelI18nKey: string, aType: string) {
|
||||||
this.functionWithChangeDetection(async () => {
|
this.functionWithChangeDetection(async () => {
|
||||||
if (
|
if (
|
||||||
cipher.reprompt !== CipherRepromptType.None &&
|
|
||||||
this.passwordRepromptService.protectedFields().includes(aType) &&
|
this.passwordRepromptService.protectedFields().includes(aType) &&
|
||||||
!(await this.passwordRepromptService.showPasswordPrompt())
|
!(await this.passwordReprompt(cipher))
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -821,9 +823,17 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async passwordReprompt(cipher: CipherView) {
|
private async passwordReprompt(cipher: CipherView) {
|
||||||
return (
|
if (cipher.reprompt === CipherRepromptType.None) {
|
||||||
cipher.reprompt === CipherRepromptType.None ||
|
this.cipherRepromptId = null;
|
||||||
(await this.passwordRepromptService.showPasswordPrompt())
|
return true;
|
||||||
);
|
}
|
||||||
|
if (this.cipherRepromptId === cipher.id) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const repromptResult = await this.passwordRepromptService.showPasswordPrompt();
|
||||||
|
if (repromptResult) {
|
||||||
|
this.cipherRepromptId = cipher.id;
|
||||||
|
}
|
||||||
|
return repromptResult;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -205,12 +205,7 @@ export class ViewComponent implements OnDestroy, OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async edit() {
|
async edit() {
|
||||||
if (await this.promptPassword()) {
|
this.onEditCipher.emit(this.cipher);
|
||||||
this.onEditCipher.emit(this.cipher);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async clone() {
|
async clone() {
|
||||||
|
|||||||
Reference in New Issue
Block a user