diff --git a/web/src/flows/stages/prompt/PromptStage.ts b/web/src/flows/stages/prompt/PromptStage.ts index f1d285eb4..9cce8181b 100644 --- a/web/src/flows/stages/prompt/PromptStage.ts +++ b/web/src/flows/stages/prompt/PromptStage.ts @@ -133,6 +133,18 @@ export class PromptStage extends BaseStage${unsafeHTML(prompt.subText)}

`; } + shouldRenderInWrapper(prompt: StagePrompt): bool { + // Special types that aren't rendered in a wrapper + if ( + prompt.type === PromptTypeEnum.Static || + prompt.type === PromptTypeEnum.Hidden || + prompt.type === PromptTypeEnum.Separator + ) { + return false; + } + return true; + } + renderField(prompt: StagePrompt): TemplateResult { // Checkbox is rendered differently if (prompt.type === PromptTypeEnum.Checkbox) { @@ -151,26 +163,19 @@ export class PromptStage extends BaseStage${unsafeHTML(prompt.subText)}

`; } - // Special types that aren't rendered in a wrapper - if ( - prompt.type === PromptTypeEnum.Static || - prompt.type === PromptTypeEnum.Hidden || - prompt.type === PromptTypeEnum.Separator - ) { - return html` + if (this.shouldRenderInWrapper(prompt)) { + return html` ${unsafeHTML(this.renderPromptInner(prompt, false))} ${this.renderPromptHelpText(prompt)} - `; + `; } - return html` - ${unsafeHTML(this.renderPromptInner(prompt, false))} - ${this.renderPromptHelpText(prompt)} - `; + return html` ${unsafeHTML(this.renderPromptInner(prompt, false))} + ${this.renderPromptHelpText(prompt)}`; } renderContinue(): TemplateResult { diff --git a/web/src/user/user-settings/details/stages/prompt/PromptStage.ts b/web/src/user/user-settings/details/stages/prompt/PromptStage.ts index 8084828c0..ff164dd2f 100644 --- a/web/src/user/user-settings/details/stages/prompt/PromptStage.ts +++ b/web/src/user/user-settings/details/stages/prompt/PromptStage.ts @@ -36,19 +36,24 @@ export class UserSettingsPromptStage extends PromptStage { renderField(prompt: StagePrompt): TemplateResult { const errors = (this.challenge?.responseErrors || {})[prompt.fieldKey]; + if (this.shouldRenderInWrapper(prompt)) { + return html` + { + return error.string; + })} + > + ${unsafeHTML(this.renderPromptInner(prompt, true))} + ${this.renderPromptHelpText(prompt)} + + `; + } return html` - { - return error.string; - })} - > - ${unsafeHTML(this.renderPromptInner(prompt, true))} - ${this.renderPromptHelpText(prompt)} - + ${unsafeHTML(this.renderPromptInner(prompt, true))} ${this.renderPromptHelpText(prompt)} `; }