diff --git a/apps/web/src/app/tools/import-export/dialog/file-password-prompt.component.html b/apps/web/src/app/tools/import-export/dialog/file-password-prompt.component.html index 0b48be7ad9e..6c849da69df 100644 --- a/apps/web/src/app/tools/import-export/dialog/file-password-prompt.component.html +++ b/apps/web/src/app/tools/import-export/dialog/file-password-prompt.component.html @@ -1,45 +1,32 @@ - - - +
+ + + {{ "confirmVaultImport" | i18n }} + + +
+ {{ "confirmVaultImportDesc" | i18n }} + + {{ "confirmFilePassword" | i18n }} + + + +
+ + + + + +
+
diff --git a/apps/web/src/app/tools/import-export/dialog/file-password-prompt.component.ts b/apps/web/src/app/tools/import-export/dialog/file-password-prompt.component.ts index ab5c51e0c85..d0cbfe20fd6 100644 --- a/apps/web/src/app/tools/import-export/dialog/file-password-prompt.component.ts +++ b/apps/web/src/app/tools/import-export/dialog/file-password-prompt.component.ts @@ -1,26 +1,20 @@ +import { DialogRef } from "@angular/cdk/dialog"; import { Component } from "@angular/core"; import { FormControl, Validators } from "@angular/forms"; -import { ModalRef } from "@bitwarden/angular/components/modal/modal.ref"; - @Component({ templateUrl: "file-password-prompt.component.html", }) export class FilePasswordPromptComponent { filePassword = new FormControl("", Validators.required); - constructor(private modalRef: ModalRef) {} + constructor(public dialogRef: DialogRef) {} submit() { this.filePassword.markAsTouched(); if (!this.filePassword.valid) { return; } - - this.modalRef.close(this.filePassword.value); - } - - cancel() { - this.modalRef.close(null); + this.dialogRef.close(this.filePassword.value); } } diff --git a/apps/web/src/app/tools/import-export/import.component.ts b/apps/web/src/app/tools/import-export/import.component.ts index 6247bcea249..14023c377de 100644 --- a/apps/web/src/app/tools/import-export/import.component.ts +++ b/apps/web/src/app/tools/import-export/import.component.ts @@ -1,7 +1,7 @@ import { Component, OnDestroy, OnInit } from "@angular/core"; import { Router } from "@angular/router"; import * as JSZip from "jszip"; -import { Subject } from "rxjs"; +import { Subject, lastValueFrom } from "rxjs"; import { takeUntil } from "rxjs/operators"; import Swal, { SweetAlertIcon } from "sweetalert2"; @@ -270,15 +270,11 @@ export class ImportComponent implements OnInit, OnDestroy { } async getFilePassword(): Promise { - const ref = this.modalService.open(FilePasswordPromptComponent, { - allowMultipleModals: true, + const dialog = this.dialogService.open(FilePasswordPromptComponent, { + ariaModal: true, }); - if (ref == null) { - return null; - } - - return await ref.onClosedPromise(); + return await lastValueFrom(dialog.closed); } ngOnDestroy(): void { diff --git a/libs/importer/src/importers/bitwarden/bitwarden-password-protected-importer.ts b/libs/importer/src/importers/bitwarden/bitwarden-password-protected-importer.ts index fb5530f3524..80872b68042 100644 --- a/libs/importer/src/importers/bitwarden/bitwarden-password-protected-importer.ts +++ b/libs/importer/src/importers/bitwarden/bitwarden-password-protected-importer.ts @@ -62,6 +62,10 @@ export class BitwardenPasswordProtectedImporter extends BitwardenJsonImporter im jdoc: BitwardenPasswordProtectedFileFormat, password: string ): Promise { + if (this.isNullOrWhitespace(password)) { + return false; + } + this.key = await this.cryptoService.makePinKey( password, jdoc.salt,