Skip to content

mcaptcha usage creates javascript error #33658

@CaveManon

Description

@CaveManon

Description

When enabling mCaptcha on a site and going to the registration page, the following Javascript error appears
JavaScript promise rejection: r.default is not a function. Open browser console to see more details.

The console points to the following line of code as the problem area:

      // @ts-expect-error
      mCaptcha.default({
        siteKey: {
          instanceUrl: new URL(instanceURL),
          key: siteKey,
        },
      });

with the error being caught (in promise) TypeError: r.default is not a function

Relevant part of app.ini here:

ENABLE_CAPTCHA = true
MCAPTCHA_SITEKEY = ***
MCAPTCHA_SECRET =  ***
CAPTCHA_TYPE = mcaptcha
MCAPTCHA_URL= https:// ***/widget/?sitekey=***

Gitea Version

1.23.3

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

Not relevant; issue is in Web UI.

Screenshots

Image

Git Version

git version 2.39.5

Operating System

Debian 6.1.124-1

How are you running Gitea?

Downloading .deb package using apt from https://packaging.gitlab.io/gitea

Database

PostgreSQL

Activity

wxiaoguang

wxiaoguang commented on Feb 20, 2025

@wxiaoguang
Contributor

-> Fix mCaptcha bug #33659

added a commit that references this issue on Feb 20, 2025
cd225d7
wxiaoguang

wxiaoguang commented on Feb 20, 2025

@wxiaoguang
Contributor

There will be a backport fix for 1.23

added a commit that references this issue on Feb 20, 2025
84049f0
added a commit that references this issue on Feb 20, 2025
9da6d4e
wxiaoguang

wxiaoguang commented on Feb 20, 2025

@wxiaoguang
Contributor

The 1.23 nightly (which is a stable release and will be 1.23.5) is ready

locked as resolved and limited conversation to collaborators on May 21, 2025
added a commit that references this issue on Jun 7, 2025
a7838b7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @wxiaoguang@CaveManon

      Issue actions

        mcaptcha usage creates javascript error · Issue #33658 · go-gitea/gitea