Skip to content

[data] Fix WebAuthn Authenticate#36

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

[data] Fix WebAuthn Authenticate#36
lukin merged 3 commits intolukin:masterfrom
horus:fix/undefined-authnSelectForm

Conversation

@horus
Copy link
Contributor

@horus horus commented Mar 7, 2023

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
Copy link
Owner

lukin commented Mar 19, 2023

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
Copy link
Contributor Author

horus commented Mar 20, 2023

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