From 1ee833c5013680aea1822da408026ffebe180be2 Mon Sep 17 00:00:00 2001 From: Ludeeus Date: Mon, 4 Oct 2021 12:57:18 +0000 Subject: [PATCH 1/3] Add more secret string fields --- src/components/ha-form/ha-form-string.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/ha-form/ha-form-string.ts b/src/components/ha-form/ha-form-string.ts index 82e4520bfa1b..8b81f4a62c9a 100644 --- a/src/components/ha-form/ha-form-string.ts +++ b/src/components/ha-form/ha-form-string.ts @@ -12,6 +12,8 @@ import type { HaFormStringSchema, } from "./ha-form"; +const SECRET_FIELDS = ["password", "client_secret", "access_secret"]; + @customElement("ha-form-string") export class HaFormString extends LitElement implements HaFormElement { @property() public schema!: HaFormStringSchema; @@ -33,7 +35,7 @@ export class HaFormString extends LitElement implements HaFormElement { } protected render(): TemplateResult { - return this.schema.name.includes("password") + return SECRET_FIELDS.includes(this.schema.name) ? html` Date: Mon, 4 Oct 2021 15:32:24 +0200 Subject: [PATCH 2/3] Update src/components/ha-form/ha-form-string.ts --- src/components/ha-form/ha-form-string.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ha-form/ha-form-string.ts b/src/components/ha-form/ha-form-string.ts index 8b81f4a62c9a..19015b90952a 100644 --- a/src/components/ha-form/ha-form-string.ts +++ b/src/components/ha-form/ha-form-string.ts @@ -12,7 +12,7 @@ import type { HaFormStringSchema, } from "./ha-form"; -const SECRET_FIELDS = ["password", "client_secret", "access_secret"]; +const SECRET_FIELDS = ["password", "client_secret", "access_secret", "secret"]; @customElement("ha-form-string") export class HaFormString extends LitElement implements HaFormElement { From e25582294168095ba809312d4b333207462db0d2 Mon Sep 17 00:00:00 2001 From: Ludeeus Date: Mon, 4 Oct 2021 15:05:43 +0000 Subject: [PATCH 3/3] Use include --- src/components/ha-form/ha-form-string.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/ha-form/ha-form-string.ts b/src/components/ha-form/ha-form-string.ts index 19015b90952a..98c4d13c30b7 100644 --- a/src/components/ha-form/ha-form-string.ts +++ b/src/components/ha-form/ha-form-string.ts @@ -12,7 +12,7 @@ import type { HaFormStringSchema, } from "./ha-form"; -const SECRET_FIELDS = ["password", "client_secret", "access_secret", "secret"]; +const MASKED_FIELDS = ["password", "secret", "token"]; @customElement("ha-form-string") export class HaFormString extends LitElement implements HaFormElement { @@ -35,7 +35,7 @@ export class HaFormString extends LitElement implements HaFormElement { } protected render(): TemplateResult { - return SECRET_FIELDS.includes(this.schema.name) + return MASKED_FIELDS.some((field) => this.schema.name.includes(field)) ? html`