Skip to content

Fix mCaptcha broken after Vite migration (#37492)#37509

Merged
bircni merged 1 commit into
go-gitea:release/v1.26from
GiteaBot:backport-37492-v1.26
May 2, 2026
Merged

Fix mCaptcha broken after Vite migration (#37492)#37509
bircni merged 1 commit into
go-gitea:release/v1.26from
GiteaBot:backport-37492-v1.26

Conversation

@GiteaBot
Copy link
Copy Markdown
Collaborator

@GiteaBot GiteaBot commented May 2, 2026

Backport #37492 by @rootful

After the Webpack-to-Vite migration (#37002), mCaptcha stopped working entirely on the registration page, throwing an error:

TypeError: setting getter-only property "INPUT_NAME"

This fix stops trying to mutate the read-only INPUT_NAME export. Instead it probes for the Widget constructor at module.default (direct) or module.default.default (CJS-wrapped), constructs the widget, and then renames the hidden input element it creates to m-captcha-response which is the field name Gitea's backend reads from the submitted form.

Generative AI was used to help with making this PR.

After the Webpack-to-Vite migration (go-gitea#37002), mCaptcha stopped working
entirely on the registration page, throwing an error:

`TypeError: setting getter-only property "INPUT_NAME"`

This fix stops trying to mutate the read-only INPUT_NAME export. Instead
it probes for the Widget constructor at module.default (direct) or
module.default.default (CJS-wrapped), constructs the widget, and then
renames the hidden input element it creates to m-captcha-response which
is the field name Gitea's backend reads from the submitted form.

Generative AI was used to help with making this PR.

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
@GiteaBot GiteaBot added type/bug lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels May 2, 2026
@GiteaBot GiteaBot requested a review from bircni May 2, 2026 15:45
@GiteaBot GiteaBot added this to the 1.26.2 milestone May 2, 2026
@GiteaBot GiteaBot requested a review from wxiaoguang May 2, 2026 15:45
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels May 2, 2026
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels May 2, 2026
@bircni bircni merged commit 8a49e9d into go-gitea:release/v1.26 May 2, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants