diff --git a/web/src/elements/stages/prompt/PromptStage.ts b/web/src/elements/stages/prompt/PromptStage.ts index fa0a27611..22d4455e9 100644 --- a/web/src/elements/stages/prompt/PromptStage.ts +++ b/web/src/elements/stages/prompt/PromptStage.ts @@ -1,5 +1,6 @@ import { gettext } from "django"; import { CSSResult, customElement, html, property, TemplateResult } from "lit-element"; +import { unsafeHTML } from "lit-html/directives/unsafe-html"; import { Challenge } from "../../../api/Flows"; import { COMMON_STYLES } from "../../../common/styles"; import { BaseStage } from "../base"; @@ -28,10 +29,10 @@ export class PromptStage extends BaseStage { return COMMON_STYLES; } - renderPromptInner(prompt: Prompt): TemplateResult { + renderPromptInner(prompt: Prompt): string { switch (prompt.type) { case "text": - return html``; case "username": - return html``; case "email": - return html``; case "password": - return html``; case "number": - return html``; case "checkbox": - return html``; case "date": - return html``; case "date-time": - return html``; case "separator": - return html`
${prompt.placeholder}
`; } - return html``; + return ""; } render(): TemplateResult { @@ -126,7 +127,7 @@ export class PromptStage extends BaseStage { ?required="${prompt.required}" class="pf-c-form__group" .errors=${(this.challenge?.response_errors || {})[prompt.field_key]}> - ${this.renderPromptInner(prompt)} + ${unsafeHTML(this.renderPromptInner(prompt))} `; })}