mirror of
https://github.com/bitwarden/browser
synced 2026-02-12 14:34:02 +00:00
Making suggested changes
This commit is contained in:
@@ -60,7 +60,7 @@ export class ExportComponent implements OnInit {
|
||||
protected win: Window,
|
||||
private logService: LogService,
|
||||
private userVerificationService: UserVerificationService,
|
||||
private formBuilder: FormBuilder,
|
||||
protected formBuilder: FormBuilder,
|
||||
protected modalService: ModalService,
|
||||
protected apiService: ApiService,
|
||||
protected stateService: StateService,
|
||||
@@ -106,6 +106,8 @@ export class ExportComponent implements OnInit {
|
||||
this.saved();
|
||||
await this.collectEvent();
|
||||
this.exportForm.get("secret").setValue("");
|
||||
this.exportForm.get("password").setValue("");
|
||||
this.exportForm.get("confirmPassword").setValue("");
|
||||
} catch (e) {
|
||||
this.logService.error(e);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ export class FilePasswordPromptComponent {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
this.i18nService.t("error"),
|
||||
this.i18nService.t("invalidMasterPassword")
|
||||
this.i18nService.t("invalidFilePassword")
|
||||
);
|
||||
} else {
|
||||
this.modalRef.close(true);
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
import { Injectable } from "@angular/core";
|
||||
|
||||
import { FilePasswordPromptService as FilePasswordPromptServiceAbstraction } from "@bitwarden/common/abstractions/filePasswordPrompt.service";
|
||||
import { KeyConnectorService } from "@bitwarden/common/abstractions/keyConnector.service";
|
||||
|
||||
import { FilePasswordPromptComponent } from "../components/file-password-prompt.component";
|
||||
|
||||
import { ModalService } from "./modal.service";
|
||||
|
||||
/**
|
||||
* Used to verify the user's File Password for the "Import passwords using File Password" feature only.
|
||||
*/
|
||||
@Injectable()
|
||||
export class FilePasswordPromptService implements FilePasswordPromptServiceAbstraction {
|
||||
protected component = FilePasswordPromptComponent;
|
||||
|
||||
constructor(
|
||||
private modalService: ModalService,
|
||||
private keyConnectorService: KeyConnectorService
|
||||
) {}
|
||||
|
||||
protectedFields() {
|
||||
return ["TOTP", "Password", "H_Field", "Card Number", "Security Code"];
|
||||
}
|
||||
|
||||
async showPasswordPrompt(fcontents: string, organizationId: string) {
|
||||
if (!(await this.enabled())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const ref = await this.modalService.open(this.component, {
|
||||
allowMultipleModals: true,
|
||||
data: {
|
||||
fileContents: fcontents,
|
||||
organizationId: organizationId,
|
||||
},
|
||||
});
|
||||
|
||||
if (ref == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const result = await ref.onClosedPromise();
|
||||
return result === true;
|
||||
}
|
||||
|
||||
async enabled() {
|
||||
return !(await this.keyConnectorService.getUsesKeyConnector());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user