();
+
+ /** Request a new value from the generator
+ * @param requestor a label used to trace generation request
+ * origin in the debugger.
+ */
+ protected generate(requestor: string) {
+ this.generate$.next(requestor);
+ }
/** Tracks changes to the selected credential type
* @param type the new credential type
@@ -154,7 +162,7 @@ export class PasswordGeneratorComponent implements OnInit, OnDestroy {
filter((a) => !a.onlyOnRequest),
takeUntil(this.destroyed),
)
- .subscribe(() => this.generate$.next());
+ .subscribe(() => this.generate("autogenerate"));
}
private typeToGenerator$(type: CredentialAlgorithm) {
diff --git a/libs/tools/generator/components/src/password-settings.component.html b/libs/tools/generator/components/src/password-settings.component.html
index 9c4fb595392..5e1d1941e74 100644
--- a/libs/tools/generator/components/src/password-settings.component.html
+++ b/libs/tools/generator/components/src/password-settings.component.html
@@ -7,13 +7,7 @@
{{ "length" | i18n }}
-
+
@@ -57,23 +51,11 @@
{{ "minNumbers" | i18n }}
-
+
{{ "minSpecial" | i18n }}
-
+
diff --git a/libs/tools/generator/components/src/password-settings.component.ts b/libs/tools/generator/components/src/password-settings.component.ts
index 2a8bff31c4a..7832818d678 100644
--- a/libs/tools/generator/components/src/password-settings.component.ts
+++ b/libs/tools/generator/components/src/password-settings.component.ts
@@ -1,7 +1,7 @@
import { coerceBooleanProperty } from "@angular/cdk/coercion";
import { OnInit, Input, Output, EventEmitter, Component, OnDestroy } from "@angular/core";
import { FormBuilder } from "@angular/forms";
-import { BehaviorSubject, takeUntil, Subject, map, filter, tap, debounceTime, skip } from "rxjs";
+import { BehaviorSubject, takeUntil, Subject, map, filter, tap, skip } from "rxjs";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { UserId } from "@bitwarden/common/types/guid";
@@ -132,14 +132,6 @@ export class PasswordSettingsComponent implements OnInit, OnDestroy {
toValidators(Controls.minSpecial, Generators.password, constraints),
);
- // forward word boundaries to the template (can't do it through the rx form)
- this.minLength = constraints.length.min;
- this.maxLength = constraints.length.max;
- this.minMinNumber = constraints.minNumber.min;
- this.maxMinNumber = constraints.minNumber.max;
- this.minMinSpecial = constraints.minSpecial.min;
- this.maxMinSpecial = constraints.minSpecial.max;
-
this.policyInEffect = constraints.policyInEffect;
const toggles = [
@@ -201,9 +193,6 @@ export class PasswordSettingsComponent implements OnInit, OnDestroy {
// now that outputs are set up, connect inputs
this.settings.valueChanges
.pipe(
- // debounce ensures rapid edits to a field, such as partial edits to a
- // spinbox or rapid button clicks don't emit spurious generator updates
- debounceTime(this.waitMs),
map((settings) => {
// interface is "avoid" while storage is "include"
const s: any = { ...settings };
@@ -216,24 +205,6 @@ export class PasswordSettingsComponent implements OnInit, OnDestroy {
.subscribe(settings);
}
- /** attribute binding for length[min] */
- protected minLength: number;
-
- /** attribute binding for length[max] */
- protected maxLength: number;
-
- /** attribute binding for minNumber[min] */
- protected minMinNumber: number;
-
- /** attribute binding for minNumber[max] */
- protected maxMinNumber: number;
-
- /** attribute binding for minSpecial[min] */
- protected minMinSpecial: number;
-
- /** attribute binding for minSpecial[max] */
- protected maxMinSpecial: number;
-
/** display binding for enterprise policy notice */
protected policyInEffect: boolean;
diff --git a/libs/tools/generator/components/src/username-generator.component.html b/libs/tools/generator/components/src/username-generator.component.html
index 3d175f32f78..008903ff68f 100644
--- a/libs/tools/generator/components/src/username-generator.component.html
+++ b/libs/tools/generator/components/src/username-generator.component.html
@@ -7,9 +7,11 @@
type="button"
bitIconButton="bwi-generate"
buttonType="main"
- (click)="generate$.next()"
+ (click)="generate('user request')"
[appA11yTitle]="credentialTypeGenerateLabel$ | async"
- >
+ >
+ {{ credentialTypeGenerateLabel$ | async }}
+
+ >
+ {{ credentialTypeCopyLabel$ | async }}
+
@@ -44,7 +48,7 @@
diff --git a/libs/tools/generator/components/src/username-generator.component.ts b/libs/tools/generator/components/src/username-generator.component.ts
index ea75ef6079c..838177d030d 100644
--- a/libs/tools/generator/components/src/username-generator.component.ts
+++ b/libs/tools/generator/components/src/username-generator.component.ts
@@ -313,7 +313,7 @@ export class UsernameGeneratorComponent implements OnInit, OnDestroy {
if (!a || a.onlyOnRequest) {
this.value$.next("-");
} else {
- this.generate$.next();
+ this.generate("autogenerate");
}
});
});
@@ -391,7 +391,15 @@ export class UsernameGeneratorComponent implements OnInit, OnDestroy {
protected readonly userId$ = new BehaviorSubject(null);
/** Emits when a new credential is requested */
- protected readonly generate$ = new Subject();
+ private readonly generate$ = new Subject();
+
+ /** Request a new value from the generator
+ * @param requestor a label used to trace generation request
+ * origin in the debugger.
+ */
+ protected generate(requestor: string) {
+ this.generate$.next(requestor);
+ }
private toOptions(algorithms: AlgorithmInfo[]) {
const options: Option[] = algorithms.map((algorithm) => ({