removing unnecessary properties
This commit is contained in:
parent
777ea96261
commit
e89ec5901e
|
@ -22,11 +22,8 @@ import { EncryptedExportType } from "@bitwarden/common/enums/EncryptedExportType
|
||||||
})
|
})
|
||||||
export class ExportComponent extends BaseExportComponent {
|
export class ExportComponent extends BaseExportComponent {
|
||||||
organizationId: string;
|
organizationId: string;
|
||||||
encryptionType: EncryptedExportType;
|
|
||||||
showPassword: boolean;
|
showPassword: boolean;
|
||||||
showConfirmPassword: boolean;
|
showConfirmPassword: boolean;
|
||||||
secretValue: string;
|
|
||||||
secret: FormControl;
|
|
||||||
confirmDescription: string;
|
confirmDescription: string;
|
||||||
confirmButtonText: string;
|
confirmButtonText: string;
|
||||||
modalTitle: string;
|
modalTitle: string;
|
||||||
|
@ -74,6 +71,10 @@ export class ExportComponent extends BaseExportComponent {
|
||||||
const confirmButtonText = "exportVault";
|
const confirmButtonText = "exportVault";
|
||||||
const modalTitle = "confirmVaultExport";
|
const modalTitle = "confirmVaultExport";
|
||||||
|
|
||||||
|
if (!this.validForm) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (
|
if (
|
||||||
await this.userVerificationPromptService.showUserVerificationPrompt(
|
await this.userVerificationPromptService.showUserVerificationPrompt(
|
||||||
|
@ -95,12 +96,14 @@ export class ExportComponent extends BaseExportComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
togglePassword() {
|
togglePassword() {
|
||||||
this.showPassword = !this.showPassword;
|
this.exportForm.get("showPassword").setValue(!this.exportForm.get("showPassword").value);
|
||||||
document.getElementById("newPassword").focus();
|
document.getElementById("newPassword").focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleConfirmPassword() {
|
toggleConfirmPassword() {
|
||||||
this.showConfirmPassword = !this.showConfirmPassword;
|
this.exportForm
|
||||||
|
.get("showConfirmPassword")
|
||||||
|
.setValue(!this.exportForm.get("showConfirmPassword").value);
|
||||||
document.getElementById("newConfirmPassword").focus();
|
document.getElementById("newConfirmPassword").focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,4 +111,28 @@ export class ExportComponent extends BaseExportComponent {
|
||||||
super.saved();
|
super.saved();
|
||||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("exportSuccess"));
|
this.platformUtilsService.showToast("success", null, this.i18nService.t("exportSuccess"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get validForm() {
|
||||||
|
if (
|
||||||
|
this.fileEncryptionType == EncryptedExportType.FileEncrypted &&
|
||||||
|
this.format == "encrypted_json"
|
||||||
|
) {
|
||||||
|
if (this.password.length > 0 || this.confirmPassword.length > 0) {
|
||||||
|
if (this.password != this.confirmPassword) {
|
||||||
|
this.platformUtilsService.showToast(
|
||||||
|
"error",
|
||||||
|
this.i18nService.t("errorOccurred"),
|
||||||
|
this.i18nService.t("filePasswordAndConfirmFilePasswordDoNotMatch")
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.encryptionPassword = this.password;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.clearPasswordField();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,10 +95,6 @@ export class ExportComponent implements OnInit {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.validForm) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.formPromise = this.getExportData();
|
this.formPromise = this.getExportData();
|
||||||
const data = await this.formPromise;
|
const data = await this.formPromise;
|
||||||
|
@ -200,30 +196,6 @@ export class ExportComponent implements OnInit {
|
||||||
await this.eventService.collect(EventType.User_ClientExportedVault);
|
await this.eventService.collect(EventType.User_ClientExportedVault);
|
||||||
}
|
}
|
||||||
|
|
||||||
get validForm() {
|
|
||||||
if (
|
|
||||||
this.fileEncryptionType == EncryptedExportType.FileEncrypted &&
|
|
||||||
this.format == "encrypted_json"
|
|
||||||
) {
|
|
||||||
if (this.password.length > 0 || this.confirmPassword.length > 0) {
|
|
||||||
if (this.password != this.confirmPassword) {
|
|
||||||
this.platformUtilsService.showToast(
|
|
||||||
"error",
|
|
||||||
this.i18nService.t("errorOccurred"),
|
|
||||||
this.i18nService.t("filePasswordAndConfirmFilePasswordDoNotMatch")
|
|
||||||
);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.encryptionPassword = this.password;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.clearPasswordField();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected clearPasswordField() {
|
protected clearPasswordField() {
|
||||||
this.encryptionPassword = "";
|
this.encryptionPassword = "";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue