Updates to error handling

This commit is contained in:
CarleyDiaz-Bitwarden 2022-06-20 14:56:57 -04:00
parent f5c78590db
commit 15949ed8bc
3 changed files with 10 additions and 6 deletions

View File

@ -5,7 +5,7 @@
<i class="bwi bwi-exclamation-triangle text-warning"></i> <i class="bwi bwi-exclamation-triangle text-warning"></i>
</div> </div>
<h2 class="modal-title tw-text-center" id="confirmUserTitle"> <h2 class="tw-text-center tw-font-semibold" id="confirmUserTitle">
{{ modalTitle | i18n }} {{ modalTitle | i18n }}
</h2> </h2>

View File

@ -5,7 +5,7 @@
<i class="bwi bwi-exclamation-triangle text-warning"></i> <i class="bwi bwi-exclamation-triangle text-warning"></i>
</div> </div>
<h2 class="modal-title tw-text-center" id="confirmUserTitle"> <h2 class="tw-text-center tw-font-semibold" id="confirmUserTitle">
{{ "confirmVaultImport" | i18n }} {{ "confirmVaultImport" | i18n }}
</h2> </h2>

View File

@ -114,12 +114,16 @@ export class ImportComponent implements OnInit {
if (error != null) { if (error != null) {
//Check if the error is that a password is required //Check if the error is that a password is required
if (error.passwordRequired) { if (error.passwordRequired) {
if (await this.promptPassword(fileContents)) { if (await this.promptFilePassword(fileContents)) {
//successful //successful
} else { } else {
//failed //failed - File Password issues
this.error(error); //TODO different error
this.loading = false; this.loading = false;
this.platformUtilsService.showToast(
"error",
this.i18nService.t("error"),
this.i18nService.t("invalidMasterPassword")
);
return; return;
} }
} else { } else {
@ -139,7 +143,7 @@ export class ImportComponent implements OnInit {
this.loading = false; this.loading = false;
} }
private async promptPassword(fcontents: string) { private async promptFilePassword(fcontents: string) {
return await this.filePasswordPromptService.showPasswordPrompt(fcontents, this.organizationId); return await this.filePasswordPromptService.showPasswordPrompt(fcontents, this.organizationId);
} }