mirror of
https://github.com/bitwarden/web
synced 2025-12-19 17:53:22 +00:00
Enforce password reprompt from reports pages (#1225)
This commit is contained in:
@@ -11,7 +11,10 @@ import { Organization } from 'jslib-common/models/domain/organization';
|
||||
import { AddEditComponent as OrgAddEditComponent } from '../organizations/vault/add-edit.component';
|
||||
import { AddEditComponent } from '../vault/add-edit.component';
|
||||
|
||||
import { CipherRepromptType } from 'jslib-common/enums/cipherRepromptType';
|
||||
|
||||
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
||||
import { PasswordRepromptService } from 'jslib-common/abstractions/passwordReprompt.service';
|
||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
||||
|
||||
import { ModalService } from 'jslib-angular/services/modal.service';
|
||||
@@ -26,7 +29,8 @@ export class CipherReportComponent {
|
||||
organization: Organization;
|
||||
|
||||
constructor(private modalService: ModalService, protected userService: UserService,
|
||||
protected messagingService: MessagingService, public requiresPaid: boolean) { }
|
||||
protected messagingService: MessagingService, protected passwordRepromptService: PasswordRepromptService,
|
||||
public requiresPaid: boolean) { }
|
||||
|
||||
async load() {
|
||||
this.loading = true;
|
||||
@@ -36,6 +40,10 @@ export class CipherReportComponent {
|
||||
}
|
||||
|
||||
async selectCipher(cipher: CipherView) {
|
||||
if (!await this.repromptCipher(cipher)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const type = this.organization != null ? OrgAddEditComponent : AddEditComponent;
|
||||
|
||||
const [modal, childComponent] = await this.modalService.openViewRef(type, this.cipherAddEditModalRef, (comp: OrgAddEditComponent | AddEditComponent) => {
|
||||
@@ -85,4 +93,8 @@ export class CipherReportComponent {
|
||||
protected async setCiphers() {
|
||||
this.ciphers = [];
|
||||
}
|
||||
|
||||
protected async repromptCipher(c: CipherView) {
|
||||
return c.reprompt === CipherRepromptType.None || await this.passwordRepromptService.showPasswordPrompt();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user