[10:01:54] tgr : Hi [10:03:07] I needed a bit of your help with the 4th task(I did checkout your review) [10:05:41] hi smartyrad [10:06:55] tgr: I have found out that the Simple captcha fields are located https://github.com/wikimedia/mediawiki-extensions-ConfirmEdit/blob/dd942b290fe5d950cd59f988dff145bec29fe13f/includes/auth/CaptchaAuthenticationRequest.php#L52 [10:07:52] A quick backgrouynd of what I'm trying to do now: I am following your advice and trying to create an instance of Simpler captcha instead of modifying a copy of fancy captcha [10:09:29] While I was trying thsi out , I realised that the fields inside Simple captcha cannot be modified by changing https://github.com/wikimedia/mediawiki-extensions-ConfirmEdit/blob/dd942b290fe5d950cd59f988dff145bec29fe13f/SimpleCaptcha/Captcha.php#L120 [10:10:14] So even a new plugin which extends simple Captcha cannot be modified in the same way I guess [10:10:46] yeah, you cannot change what data the auth plugin gets [10:11:00] but it's generic enough that it should be OK for any captcha [10:11:37] So I feel the best way would be to modify it using onAuthChangeFormFields https://github.com/wikimedia/mediawiki-extensions-ConfirmEdit/blob/dd942b290fe5d950cd59f988dff145bec29fe13f/SimpleCaptcha/Captcha.php#L1125 [10:11:39] the ID is for matching captcha submissions to server-side data [10:11:46] Am i right? [10:12:00] info is what gets displayed to the user, word is what gets returned by the user [10:12:40] you can change how those fields are represented in HTML, doesn't necessarily have to be 3 HTML input fields [10:12:50] some of the captcha plugins do that [10:13:00] but for the microtask you don't really have to [10:14:06] onAuthChangeFormFields is where you tell the HTML form what widgets to use, that's correct [10:14:37] tgr: So how do you suggest I go about adding a button? Shall I add another html.php which describes the widget? [10:14:54] for background, when ConfirmEdit was originally written, everything used raw HTML, so it returned a HTML snippet [10:15:20] then we updated login/registration to use HTMLForm which is a MediaWiki library for building forms [10:15:50] Captcha::getFormInformation is used for the other captcha forms which have not been changed like that [10:15:56] e.g. on the edit page [10:16:38] the registration page will use the AuthChangeFormFields hook instead [10:17:07] tgr: Ah I see, it is quite clear to me now :) [10:17:09] so basically you need to change $formDescriptor['captchaWord'] to be a button instead of a text field [10:17:41] or button group, or radio button group, or something like that [10:18:14] probably radio button / checkbox is the simplest, a capctha is not really expected to have its own submit button [10:19:04] tgr: Yeah true so I guess we'll have to add the logic to check whether the radio button is checked as well right? [10:19:22] the documentation for HTMLFormField sucks, like so many things, but you can find some information at https://www.mediawiki.org/wiki/HTMLForm/tutorial3 [10:19:53] the generic idea is that you build an array representation of how your form should look like [10:20:26] pass that to HTMLForm (or in your case that happens somewhere else, you just need to modify the array) [10:20:44] HTMLForm handles the submit and returns an array representation of the submitted data [10:21:38] tgr: Thanks for that! So, if my understanding is correct then $formDescriptor['captchaWord'] = [some html form code here] should help modify the captcha right? [10:22:02] The above code within the onAuthChangeFormFields function [10:22:55] so for example something like HtmlForm::factory( ['isBot' => ['type'=>'multiselect', 'options' => [ 'Bot' => 1, 'Not a bot' => 0 ] ] ]) will generate a form with a dropdown [10:23:30] and then the user submits the form and you get back something like ['isBot' => 0] [10:23:49] real HTML is hidden from you by the helper classes [10:24:31] so yeah just change captchaWord and captchaInfo accordingly [10:26:24] and then you can see around https://github.com/wikimedia/mediawiki-extensions-ConfirmEdit/blob/dd942b290fe5d950cd59f988dff145bec29fe13f/includes/auth/CaptchaPreAuthenticationProvider.php#L95 how the captcha submission is processed [10:26:58] tgr: Okay, I'll try to change it as per your suggestions. Another thing is as to where can I add my logic to check if the radio button was selected or not? [10:27:25] that's what I linked above [10:27:40] well, not quite, but check what captcha methods are called by that code [10:28:48] tgr : Sure ,thanks a lot for your time, I'll try it out and get back to you