Skip to content

[data] Fix WebAuthn Authenticate - #36

Merged
lukin merged 3 commits into
lukin:masterfrom
horus:fix/undefined-authnSelectForm
Mar 19, 2023
Merged

lukin merged 3 commits into
lukin:masterfrom
horus:fix/undefined-authnSelectForm

Conversation

@horus

@horus horus commented Mar 7, 2023 •

Copy link
Copy Markdown
Contributor

Hello,

I've noticed that

      <#if authenticators??>
        <form x-ref="authnSelectForm">
          <#list authenticators.authenticators as authenticator>
            <input value="${authenticator.credentialId}" type="hidden" />
          </#list>
        </form>

There are some circumstances which an user instance's not required (i.e., passwordless), thus authenticators will evaluate to null, which further cause the form being skipped entirely.

According to the code in webauthn-authenticate.ftl#L95, the authnSelectForm should be checked.
Otherwise it will result in error:

Uncaught TypeError: can't access property "elements", l is undefined

This PR tries to address the issue. Thank you!

@lukin

lukin commented Mar 19, 2023

Copy link
Copy Markdown
Owner

Hey @horus 👋

Thank you for your contribution. I'll prepare a build for this fix.

@lukin lukin changed the title Fix: handle possibly undefined authnSelectForm [data] Fix WebAuthn Authenticate Mar 19, 2023
@lukin
lukin merged commit d3836c0 into lukin:master Mar 19, 2023
@horus

horus commented Mar 20, 2023

Copy link
Copy Markdown
Contributor Author

Glad I could be of help!
Thank you for creating and maintaining this.

lukin added a commit that referenced this pull request Oct 24, 2023
Co-authored-by: Anthony Lukin <anthony@lukin.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants