1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-11 22:03:36 +00:00

[PM-129] Refactor email forwarding providers to remove filtering for self-hosted (#4963)

* Added model for email forwarder options

* Refactored code base to use model and filter based on the new model
This commit is contained in:
SmithThe4th
2023-03-13 10:00:48 -04:00
committed by GitHub
parent d74504ec72
commit 1666488672
3 changed files with 15 additions and 17 deletions

View File

@@ -6,6 +6,7 @@ import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/abstractions/log.service";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { StateService } from "@bitwarden/common/abstractions/state.service";
import { EmailForwarderOptions } from "@bitwarden/common/models/domain/email-forwarder-options";
import { PasswordGeneratorPolicyOptions } from "@bitwarden/common/models/domain/password-generator-policy-options";
import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password";
import { UsernameGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/username";
@@ -22,7 +23,7 @@ export class GeneratorComponent implements OnInit {
usernameTypeOptions: any[];
subaddressOptions: any[];
catchallOptions: any[];
forwardOptions: any[];
forwardOptions: EmailForwarderOptions[];
usernameOptions: any = {};
passwordOptions: any = {};
username = "-";
@@ -236,11 +237,11 @@ export class GeneratorComponent implements OnInit {
private async initForwardOptions() {
this.forwardOptions = [
{ name: "AnonAddy", value: "anonaddy" },
{ name: "DuckDuckGo", value: "duckduckgo" },
{ name: "Fastmail", value: "fastmail" },
{ name: "Firefox Relay", value: "firefoxrelay" },
{ name: "SimpleLogin", value: "simplelogin" },
{ name: "AnonAddy", value: "anonaddy", validForSelfHosted: true },
{ name: "DuckDuckGo", value: "duckduckgo", validForSelfHosted: false },
{ name: "Fastmail", value: "fastmail", validForSelfHosted: true },
{ name: "Firefox Relay", value: "firefoxrelay", validForSelfHosted: false },
{ name: "SimpleLogin", value: "simplelogin", validForSelfHosted: true },
];
this.usernameOptions = await this.usernameGenerationService.getOptions();
@@ -248,7 +249,7 @@ export class GeneratorComponent implements OnInit {
this.usernameOptions.forwardedService == null ||
this.usernameOptions.forwardedService === ""
) {
this.forwardOptions.push({ name: "", value: null });
this.forwardOptions.push({ name: "", value: null, validForSelfHosted: false });
}
this.forwardOptions = this.forwardOptions.sort((a, b) => a.name.localeCompare(b.name));