Page MenuHomePhabricator

Flow not displaying Captcha of Extension:ConfirmEdit-ReCaptchaNoCaptcha
Closed, ResolvedPublic


Hey guys,

I am facing a problem with Flow together with ConfirmEdit, especially the ReCaptchaNoCaptcha subextension.

I am not sure if this is an issue with Flow or with ConfirmEdit so I am pinging both of the projects.

The issue is only presented while using the ReCaptchaNoCaptcha feature, it is not present with using ConfirmEdit:QuestyCaptcha.

If I enable ReCaptchaNoCaptcha and try to post a Flow discussion the Captcha is not displayed when pressing the submit button. A message saying "Please insert the Captcha" is displayed but nothing after that.

Here is an example:

1.png (462×726 px, 41 KB)

I tried to do some debugging and this is what I figured out

tmpil5pq2-save.png (354×443 px, 64 KB)

Part of the Captcha feature is inserted inside a nonscript tag and its HTML entities are escaped like so:

tmpESpaWu-save.png (333×353 px, 36 KB)

This will cause them to don't get rendered.

I tried to hack my way in the code but not much changed, I managed to display the Captcha feature but validation was not working.

My setup

How to reproduce

  • Install Flow and ConfirmEdit
  • Enable ConfirmEdit:ReCaptchaNoCaptcha
  • Create a Flow post/discussion
  • Failed Workaound **

A workaround I tried was to disable the captcha on flow/discussion pages but that did not work too.

The ConfirmEdit docs provide $wgCaptchaTriggersOnNamespace[NS_TALK]['edit'] = false; to disable Captcha on a specific namespace. I then tried to

$wgCaptchaTriggersOnNamespace[NS_TALK]['edit']          = false;
$wgCaptchaTriggersOnNamespace[NS_TALK]['create']        = false;
$wgCaptchaTriggersOnNamespace[NS_TALK]['addurl']        = false;

but that did not change anything. On this one I have no idea right now. Some months ago (so I could remember wrong) I did some debugging on this issue and somehow I remember that on Flow pages the namespace was not NS_TALK but NS_MAIN, but this was many months ago, so it could be complerely wrong.

Thanks for the help

Event Timeline

Restricted Application added subscribers: Florian, Aklapper. · View Herald Transcript

Unfortunately, ReCaptchaNoCaptcha doesn't really work over the ConfirmEdit api. So, as long as the user (Flow) of the api doesn't implement some hacks to display the captcha correctly, it won't really work :(

There is nothing special about NS_MAIN in Flow.

You're right, it should respect the namespace limits.

Also, we recently made significant changes to how Flow uses the CAPTCHA for T140472: Flow: Update to stop using buildCssLinks and for related ConfirmEdit change. I am probably not going to have time to backport this, though.

For new topics, the title is the board/talk page, so the namespace would be NS_TALK if the board is e.g. Talk:Math. For actions on an existing topic, it is NS_TOPIC (maybe it should be the owner board, but if you want to workaround it for all Flow topics this should work for now).

I should have been more clear. wgCaptchaTriggersOnNamespace should work currently as long as you specify the right namespaces.

T140472: Flow: Update to stop using buildCssLinks and for related ConfirmEdit change affects how the CAPTCHA is rendered on the client and may affect the reCAPTCHA issue.


I kept experimenting with $wgCaptchaTriggersOnNamespace but it still asks for captcha on the namespaces.

2016-08-25-095002_1366x768_scrot.png (768×1 px, 697 KB)

The code I am using is

$wgCaptchaTriggersOnNamespace[NS_TALK] = false;
$wgCaptchaTriggersOnNamespace[NS_TOPIC] = false

I have no idea what's going wrong here.

Change 306739 had a related patch set uploaded (by Mattflaschen):
extension.json: 1st dimension is namespace ID, so avoid re-numbering

See the docs: . It is a two-dimensional array with both namespace and action.

You had it right the first time, except you also need to add NS_TOPIC (and any namespaces other than NS_TALK where boards live):

$wgCaptchaTriggersOnNamespace[NS_TALK]['edit'] = false;
$wgCaptchaTriggersOnNamespace[NS_TALK]['create'] = false;
$wgCaptchaTriggersOnNamespace[NS_TALK]['addurl'] = false;

$wgCaptchaTriggersOnNamespace[NS_TOPIC]['edit'] = false;
$wgCaptchaTriggersOnNamespace[NS_TOPIC]['create'] = false;
$wgCaptchaTriggersOnNamespace[NS_TOPIC]['addurl'] = false;

Make sure this is after both Flow and ConfirmEdit are included.

Also, I noticed a bug in ConfirmEdit, so you'll need that fix too.

Oh, sorry for that.

What's the bug about?

What's the bug about?

The change to use extension.json messed up the wgCaptchaTriggersOnNamespace config variable. It wasn't getting set to the correct indices.

Change 306739 merged by jenkins-bot:
extension.json: 1st dimension is namespace ID, so avoid re-numbering

Catrope claimed this task.
Catrope reassigned this task from Catrope to Mattflaschen-WMF.
Catrope added a subscriber: Catrope.