diff --git a/apps/browser/src/popup/app-routing.module.ts b/apps/browser/src/popup/app-routing.module.ts index 1969fb564a..3b5995de27 100644 --- a/apps/browser/src/popup/app-routing.module.ts +++ b/apps/browser/src/popup/app-routing.module.ts @@ -32,6 +32,7 @@ import { SendAddEditComponent } from "./send/send-add-edit.component"; import { SendGroupingsComponent } from "./send/send-groupings.component"; import { SendTypeComponent } from "./send/send-type.component"; import { DebounceNavigationService } from "./services/debounceNavigationService"; +import { AutofillComponent } from "./settings/autofill.component"; import { ExcludedDomainsComponent } from "./settings/excluded-domains.component"; import { ExportComponent } from "./settings/export.component"; import { FolderAddEditComponent } from "./settings/folder-add-edit.component"; @@ -187,6 +188,12 @@ const routes: Routes = [ canActivate: [AuthGuard], data: { state: "export" }, }, + { + path: "autofill", + component: AutofillComponent, + canActivate: [AuthGuard], + data: { state: "autofill" }, + }, { path: "folders", component: FoldersComponent, diff --git a/apps/browser/src/popup/app.module.ts b/apps/browser/src/popup/app.module.ts index 3d04f79787..e018375e5c 100644 --- a/apps/browser/src/popup/app.module.ts +++ b/apps/browser/src/popup/app.module.ts @@ -62,6 +62,7 @@ import { SendGroupingsComponent } from "./send/send-groupings.component"; import { SendTypeComponent } from "./send/send-type.component"; import { ServicesModule } from "./services/services.module"; import { AboutComponent } from "./settings/about.component"; +import { AutofillComponent } from "./settings/autofill.component"; import { ExcludedDomainsComponent } from "./settings/excluded-domains.component"; import { ExportComponent } from "./settings/export.component"; import { FolderAddEditComponent } from "./settings/folder-add-edit.component"; @@ -147,6 +148,7 @@ import { TabsComponent } from "./tabs.component"; RemovePasswordComponent, VaultSelectComponent, AboutComponent, + AutofillComponent, ], providers: [CurrencyPipe, DatePipe], bootstrap: [AppComponent], diff --git a/apps/browser/src/popup/settings/autofill.component.html b/apps/browser/src/popup/settings/autofill.component.html new file mode 100644 index 0000000000..acc9dcbe46 --- /dev/null +++ b/apps/browser/src/popup/settings/autofill.component.html @@ -0,0 +1,74 @@ +
+
+ +
+

+ {{ "autofill" | i18n }} +

+
+
+
+
+
+
+ + +
+
+ +
+
+
+
+ + +
+
+ +
+
+
+
+ + +
+
+ +
+
diff --git a/apps/browser/src/popup/settings/autofill.component.ts b/apps/browser/src/popup/settings/autofill.component.ts new file mode 100644 index 0000000000..0de3ee425c --- /dev/null +++ b/apps/browser/src/popup/settings/autofill.component.ts @@ -0,0 +1,54 @@ +import { Component, OnInit } from "@angular/core"; + +import { I18nService } from "@bitwarden/common/abstractions/i18n.service"; +import { StateService } from "@bitwarden/common/abstractions/state.service"; +import { UriMatchType } from "@bitwarden/common/enums/uriMatchType"; + +@Component({ + selector: "app-autofill", + templateUrl: "autofill.component.html", +}) +export class AutofillComponent implements OnInit { + enableAutoFillOnPageLoad = false; + autoFillOnPageLoadDefault = false; + autoFillOnPageLoadOptions: any[]; + defaultUriMatch = UriMatchType.Domain; + uriMatchOptions: any[]; + + constructor(private stateService: StateService, i18nService: I18nService) { + this.autoFillOnPageLoadOptions = [ + { name: i18nService.t("autoFillOnPageLoadYes"), value: true }, + { name: i18nService.t("autoFillOnPageLoadNo"), value: false }, + ]; + this.uriMatchOptions = [ + { name: i18nService.t("baseDomain"), value: UriMatchType.Domain }, + { name: i18nService.t("host"), value: UriMatchType.Host }, + { name: i18nService.t("startsWith"), value: UriMatchType.StartsWith }, + { name: i18nService.t("regEx"), value: UriMatchType.RegularExpression }, + { name: i18nService.t("exact"), value: UriMatchType.Exact }, + { name: i18nService.t("never"), value: UriMatchType.Never }, + ]; + } + + async ngOnInit() { + this.enableAutoFillOnPageLoad = await this.stateService.getEnableAutoFillOnPageLoad(); + + this.autoFillOnPageLoadDefault = + (await this.stateService.getAutoFillOnPageLoadDefault()) ?? true; + + const defaultUriMatch = await this.stateService.getDefaultUriMatch(); + this.defaultUriMatch = defaultUriMatch == null ? UriMatchType.Domain : defaultUriMatch; + } + + async updateAutoFillOnPageLoad() { + await this.stateService.setEnableAutoFillOnPageLoad(this.enableAutoFillOnPageLoad); + } + + async updateAutoFillOnPageLoadDefault() { + await this.stateService.setAutoFillOnPageLoadDefault(this.autoFillOnPageLoadDefault); + } + + async saveDefaultUriMatch() { + await this.stateService.setDefaultUriMatch(this.defaultUriMatch); + } +} diff --git a/apps/browser/src/popup/settings/options.component.html b/apps/browser/src/popup/settings/options.component.html index cdf8d93c0c..3f60d4e68f 100644 --- a/apps/browser/src/popup/settings/options.component.html +++ b/apps/browser/src/popup/settings/options.component.html @@ -26,25 +26,6 @@ -
-
-
- - -
-
- -
@@ -228,61 +209,4 @@
-
-

- -

-
- -
-
-
- - -
-
- -
-
-
-
- - -
-
- -
-
diff --git a/apps/browser/src/popup/settings/settings.component.html b/apps/browser/src/popup/settings/settings.component.html index 547a03bd57..d371acc450 100644 --- a/apps/browser/src/popup/settings/settings.component.html +++ b/apps/browser/src/popup/settings/settings.component.html @@ -11,6 +11,14 @@

{{ "manage" | i18n }}

+