web/flows: fix passwordless hidden without input (#9273)

This commit is contained in:
Jens L
2024-04-15 19:11:32 +02:00
committed by GitHub
parent 1c9f86e172
commit 05e3d8db83

View File

@ -194,14 +194,14 @@ export class IdentificationStage extends BaseStage<
${msg("Need an account?")} ${msg("Need an account?")}
<a id="enroll" href="${this.challenge.enrollUrl}">${msg("Sign up.")}</a> <a id="enroll" href="${this.challenge.enrollUrl}">${msg("Sign up.")}</a>
</p>` </p>`
: html``} : nothing}
${this.challenge.recoveryUrl ${this.challenge.recoveryUrl
? html`<p class="pf-c-login__main-footer-band-item"> ? html`<p class="pf-c-login__main-footer-band-item">
<a id="recovery" href="${this.challenge.recoveryUrl}" <a id="recovery" href="${this.challenge.recoveryUrl}"
>${msg("Forgot username or password?")}</a >${msg("Forgot username or password?")}</a
> >
</p>` </p>`
: html``} : nothing}
</div>`; </div>`;
} }
@ -265,26 +265,18 @@ export class IdentificationStage extends BaseStage<
/> />
</ak-form-element> </ak-form-element>
` `
: html``} : nothing}
${"non_field_errors" in (this.challenge?.responseErrors || {}) ${"non_field_errors" in (this.challenge?.responseErrors || {})
? this.renderNonFieldErrors(this.challenge?.responseErrors?.non_field_errors || []) ? this.renderNonFieldErrors(this.challenge?.responseErrors?.non_field_errors || [])
: html``} : nothing}
<div class="pf-c-form__group pf-m-action"> <div class="pf-c-form__group pf-m-action">
<button type="submit" class="pf-c-button pf-m-primary pf-m-block"> <button type="submit" class="pf-c-button pf-m-primary pf-m-block">
${this.challenge.primaryAction} ${this.challenge.primaryAction}
</button> </button>
</div> </div>
${this.challenge.passwordlessUrl ${this.challenge.passwordlessUrl
? html`<ak-divider>${msg("Or")}</ak-divider> ? html`<ak-divider>${msg("Or")}</ak-divider>`
<div> : nothing}`;
<a
href=${this.challenge.passwordlessUrl}
class="pf-c-button pf-m-secondary pf-m-block"
>
${msg("Use a security key")}
</a>
</div>`
: html``}`;
} }
render(): TemplateResult { render(): TemplateResult {
@ -306,8 +298,20 @@ export class IdentificationStage extends BaseStage<
? html`<p> ? html`<p>
${msg(str`Login to continue to ${this.challenge.applicationPre}.`)} ${msg(str`Login to continue to ${this.challenge.applicationPre}.`)}
</p>` </p>`
: html``} : nothing}
${this.renderInput()} ${this.renderInput()}
${this.challenge.passwordlessUrl
? html`
<div>
<a
href=${this.challenge.passwordlessUrl}
class="pf-c-button pf-m-secondary pf-m-block"
>
${msg("Use a security key")}
</a>
</div>
`
: nothing}
</form> </form>
</div> </div>
<footer class="pf-c-login__main-footer"> <footer class="pf-c-login__main-footer">