1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-21 18:53:29 +00:00

[PM-26666] Timeout setting error (#16812)

* do not show organization error message for any invalid timeout

* use newValue rather than the current form value when early return

* add missing error message
This commit is contained in:
Nick Krantz
2025-10-15 14:32:38 -05:00
committed by GitHub
parent eee2aca111
commit fceaa6d39c
3 changed files with 4 additions and 12 deletions

View File

@@ -629,7 +629,6 @@ describe("SettingsComponent", () => {
}); });
it("should not save vault timeout when vault timeout is invalid", async () => { it("should not save vault timeout when vault timeout is invalid", async () => {
i18nService.t.mockReturnValue("Number too large test error");
component["form"].controls.vaultTimeout.setErrors({}, { emitEvent: false }); component["form"].controls.vaultTimeout.setErrors({}, { emitEvent: false });
await component.saveVaultTimeout(DEFAULT_VAULT_TIMEOUT, 999_999_999); await component.saveVaultTimeout(DEFAULT_VAULT_TIMEOUT, 999_999_999);
@@ -639,11 +638,6 @@ describe("SettingsComponent", () => {
DEFAULT_VAULT_TIMEOUT_ACTION, DEFAULT_VAULT_TIMEOUT_ACTION,
); );
expect(component["form"].getRawValue().vaultTimeout).toEqual(DEFAULT_VAULT_TIMEOUT); expect(component["form"].getRawValue().vaultTimeout).toEqual(DEFAULT_VAULT_TIMEOUT);
expect(platformUtilsService.showToast).toHaveBeenCalledWith(
"error",
null,
"Number too large test error",
);
}); });
}); });

View File

@@ -510,16 +510,11 @@ export class SettingsComponent implements OnInit, OnDestroy {
} }
// Avoid saving 0 since it's useless as a timeout value. // Avoid saving 0 since it's useless as a timeout value.
if (this.form.value.vaultTimeout === 0) { if (newValue === 0) {
return; return;
} }
if (!this.form.controls.vaultTimeout.valid) { if (!this.form.controls.vaultTimeout.valid) {
this.platformUtilsService.showToast(
"error",
null,
this.i18nService.t("vaultTimeoutTooLarge"),
);
return; return;
} }

View File

@@ -2549,6 +2549,9 @@
} }
} }
}, },
"vaultCustomTimeoutMinimum": {
"message": "Minimum custom timeout is 1 minute."
},
"inviteAccepted": { "inviteAccepted": {
"message": "Invitation accepted" "message": "Invitation accepted"
}, },