Extension talk:CIForms

About this board

reCAPTCHA token timeout

1
Jachym16 (talkcontribs)

Hi, I use reCAPTCHA V3 in CIForms for users to fill out their requests. Recently, users started to complain about errors when sending the form. It turned out the error is timeout-or-duplicate. Since the token is generated once the page is loaded and its lifetime is just 2 minutes, it can take more time for users to fill out the form. So far, I fixed it by calling the function that generates the captcha token every 90 seconds. The change was made in resources/validation.js. The patch is below. Is there any chance to fix this?

--- validation.js 2024-04-10 08:33:50.225438151 +0200

+++ validation_new.js 2024-04-10 08:33:43.701502919 +0200

@@ -35,6 +35,34 @@

.replace( />/g, '\x3E' );

}

+  function executeRecaptchaValidation() {

+    var site_key = mw.config.get('ci_forms_google_recaptcha_site_key');

+

+    mw.loader.getScript('https://www.google.com/recaptcha/api.js?render=' + site_key)

+        .then(

+            function () {

+                if ($('input[name="g-recaptcha-response"]').length) {

+                    grecaptcha.ready(function () {

+                        grecaptcha.execute(site_key, { action: 'validate_captcha' })

+                            .then(function (token) {

+                                $('input[name="g-recaptcha-response"]').val(token);

+                            })

+                            .catch(function (error) {});

+                    });

+                }

+            },

+            function (e) {

+                mw.log.error(e.message);

+            }

+        );

+  }

+

+  executeRecaptchaValidation();

+  // Obnoveni recaptcha tokenu kazdych 90 vterin

+  setInterval(executeRecaptchaValidation, 90 * 1000);

+

+

+  /*

var site_key = mw.config.get( 'ci_forms_google_recaptcha_site_key' );

mw.loader

@@ -57,6 +85,8 @@

}

);

+  */

+

$( '.ci_form' ).each( function ( index ) {

var paging = $( this )

.find( 'input[type=hidden][name=form_paging]' )

Reply to "reCAPTCHA token timeout"

CIForms support reCAPTCHA V2/V3 ?

2
Lotusccong (talkcontribs)

I have the isnert the secret and site key in the $wgCIFormsGoogleRecaptchaSiteKey and $wgCIFormsGoogleRecaptchaSecret .

The form only show the text "form protected using Google recaptcha" without render the widget on the page. I used reCAPTCHA V2 and V3 both has the same issues.

Did I missed out anything steps to enable the form to support reCAPTCHA ?

Jachym16 (talkcontribs)

Hi, reCAPTCHA V3 works in the background. It checks the user's score and based on that decides whether to send the form or not. I believe the default score is set to 0.5.

Reply to "CIForms support reCAPTCHA V2/V3 ?"

Just Installed on 1.41

5
Findjam (talkcontribs)

Hi, I just installed this on MW 1.41 without reading this discussion and I've just learned that it isn't compatible with 1.41 yet,

When I go to Tools -> Special Pages I get an error now and cannot view those pages'

[3ea6e9ec6c538d7cf9d141aa] 2024-03-01 14:01:37: Fatal exception of type "Error".

If I disable the plugin in LocalSettings.php I can then view the special pages again.

I'm not sure what I should do? I'm concerned it's permanently damaged my install in some way. What is the recommended course of action?

Also when I ran the maintainance/update.php It seemed to run ok but there was a warning that I should have executed maintainance/run.php instead. Could this be the problem?

Thanks.

Findjam (talkcontribs)

I've just looked in the error log:

[01-Mar-2024 14:16:40 Europe/London] PHP Deprecated:  Use of ParserOutput::getFlag was deprecated in MediaWiki 1.38. [Called from CIForms::onOutputPageParserOutput in <snipped>/extensions/CIForms/includes/CIForms.php at line 79] in <snipped>/includes/debug/MWDebug.php on line 386

Thomas-topway-it (talkcontribs)

hello @Findjam if you just comment it on LocalSettings there won't be any kind of damage to the MW installation. Just, currently it does not work on MW 1.41, I don't still have an ETA for this but you can contact me directly for specific support

Findjam (talkcontribs)

Hi Thomas,

Thanks for the reply. No problem at all. I have done that and I just rolled back the DB a few hours just to be on the safe side. No harm done.

Look forward to the update as this really does seem to be the best and most feature rich Form extension, unless I've missed something. If I find some time I may roll my sleeves up and take a look, possibly create a PR on GitHub.

Thomas-topway-it (talkcontribs)
Reply to "Just Installed on 1.41"

dompdf/dompdf SSRF issue

2
Taavi (talkcontribs)
Thomas-topway-it (talkcontribs)

thank you, I will do at the next update of the extension

Reply to "dompdf/dompdf SSRF issue"

CIForms support MW 1.39 ?

5
Lotusccong (talkcontribs)

When we click the Download lick, it only show the 1.40, 1.41 and Master (latest development version) .

Which one that I should choose for MW 1.39 ?

Thomas-topway-it (talkcontribs)

I think always master, unfortunately the extension does not work on MW 1.41.0. I planned to do a general update of it but had other priorities meanwhile @Lotusccong

School4schools (talkcontribs)

Will look forward to update to MW 1.4+ Great and much appreciated extension!

Thomas-topway-it (talkcontribs)

hello @School4schools thanks for your feedback, if you have a public use-case I can post it on the extension's page

School4schools (talkcontribs)

My site is www.school4schools.wiki I was interested in CIF forms for contact forms (I turned them off bc of spam) and quizzes for classes. I haven't implemented them yet, as this is a long-term, side-project. I do need to update to 1.41 for certain new features it brings, including for mobile viewing via MobileFrontend extension, which doesn't work w/ 1.39.

So I'm not a priority, but letting you know you have a great extension!

Reply to "CIForms support MW 1.39 ?"

Cannot load Special:CIFormsManage or Special:SpecialPages (500 error)

4
Tarunjoseph93 (talkcontribs)

I currently have the 1.39 package for CI Forms running on MediaWiki 1.41. I've had this issue even when MediaWiki was at version 1.39. Basically when I load the pages Special:CIFormsManage or Special:SpecialPages, I get the following errors:

[562694b55f00e86faf703aa2] /index.php/Special:CIFormsManage Error: Class "MediaWiki\Navigation\PrevNextNavigationRenderer" not found Backtrace: from /var/www/html/extensions/CIForms/includes/specials/PrevNextNavigationRendererCIForms.php(24)

  1. 0 /var/www/html/extensions/CIForms/includes/specials/CIFormsManage.php(24): include_once()
  2. 1 /var/www/html/includes/AutoLoader.php(221): require(string)
  3. 2 [internal function]: AutoLoader::autoload(string)
  4. 3 /var/www/html/vendor/wikimedia/object-factory/src/ObjectFactory.php(285): class_exists(string)
  5. 4 /var/www/html/vendor/wikimedia/object-factory/src/ObjectFactory.php(174): Wikimedia\ObjectFactory\ObjectFactory::validateSpec(string, array)
  6. 5 /var/www/html/vendor/wikimedia/object-factory/src/ObjectFactory.php(149): Wikimedia\ObjectFactory\ObjectFactory::getObjectFromSpec(string, array)
  7. 6 /var/www/html/includes/specialpage/SpecialPageFactory.php(1474): Wikimedia\ObjectFactory\ObjectFactory->createObject(string, array)
  8. 7 /var/www/html/includes/MediaWiki.php(304): MediaWiki\SpecialPage\SpecialPageFactory->getPage(string)
  9. 8 /var/www/html/includes/MediaWiki.php(960): MediaWiki->performRequest()
  10. 9 /var/www/html/includes/MediaWiki.php(613): MediaWiki->main()
  11. 10 /var/www/html/index.php(50): MediaWiki->run()
  12. 11 /var/www/html/index.php(46): wfIndexMain()
  13. 12 {main}

Not sure how to resolve this as no forums online seem to address this issue. Any help would be appreciated.

Thomas-topway-it (talkcontribs)

@Tarunjoseph93 since MW 1.41 the class PrevNextNavigationRenderer has been removed, as a consequence CIForms is not currently compatible with MW 1.41. I have scheduled to do a general maintenance of the extension, but I don't have yet an ETA. If you need urgent support you can contact me by email

Tarunjoseph93 (talkcontribs)

Does this mean I need to revert my MW version to 1.40 or 1.39?

Thomas-topway-it (talkcontribs)

unless you can/want disable CIForms, yes

Reply to "Cannot load Special:CIFormsManage or Special:SpecialPages (500 error)"

Problem with formatting Czech characters inside PDF

1
Jachym16 (talkcontribs)

Hi,  I have a problem with exporting the forms data into PDF. Not all Czech characters inside the PDF are formatted correctly. I found out that it is the text font that is causing this issue. I found a font that fixes the problem. The solution is to add the line of code from below into createPDF function, inside the $form_output_html variable, inside <style>. After that, all Czech characters are formatted correctly.

$form_output_html .= '* { font-family: DejaVu Sans, sans-serif; }';

Reply to "Problem with formatting Czech characters inside PDF"

Specify multiple groups for Special:CIFormsManage

1
BakiDance1 (talkcontribs)

I'm trying to set global access to the form management page via $wgCIFormsDataAccess. I see that the groups here are supposed to be comma separated, but I can't seem to figure out exactly how to get it to work. No matter what I specify in my LocalSettings.php, form visibility still defaults to sysop (which isn't even a valid group on my installation.)

EG:

$wgCIFormsDataAccess = array ( 'cubey', 'owner', 'admin', 'mod', 'support' );
Reply to "Specify multiple groups for Special:CIFormsManage"

Page status indicators after upgrading MediaWiki

5
Cru121 (talkcontribs)

I had our MediaWiki software updated from 1.35 to 1.39. After the upgrade, the number "1" started appearing on all our wiki pages that use CIForms, in the top right corner of the page, in the title line.

<div class="mw-indicators">
<div id="mw-indicator-ciform" class="mw-indicator"><div class="mw-parser-output">1</div></div>
</div>

Apparently, this is a page status indicator. Any tips how to turn it off? I guess I could hide it via CSS.

Ciencia Al Poder (talkcontribs)

You should locate the indicator in the page source (or template) and remove it from the page. Hiding it with CSS is just hiding the problem, not solving it.

Cru121 (talkcontribs)

Neither the page source nor the template adds the indicator. Even a brand new page with the following code displays it.

{{#CI form: title = Hello world}}
Ciencia Al Poder (talkcontribs)

I don't know what's #CI form and what it does. Can you create a page with *only* Hello world?

Also, what extensions have you installed? Maybe one of the extensions is adding it

Thomas-topway-it (talkcontribs)

@Cru121 and @Ciencia Al Poder I'm sorry for the delay, I plan to publish a version that solves the issue as soon as possible, with some new feature

Reply to "Page status indicators after upgrading MediaWiki"

Added a second database table, changed mail body filled with form data

1
Parzival1200 (talkcontribs)

I added a second databasetable defined in LocalSettings, because I needed to export a cleaner Json with only selected fields an less dataoverhead. it is checked whether the database exists, if not it is created, if that fails nothing is done.

I am not very familiar with coding in mediawiki extensions nor in php. May be you want to take a look https://github.com/marcwoge/mediawiki-extensions-JSonForms (I only edited CIFormsSubmit.php) Would appreciate any feedback.

Created some new functions:

- createJson

- updateDBsecondtable

- create_output

and made a few changes to function execute()


I will need to clean up the email-body as it looks not really nice (it's only the pdf html with all the missing css) .

My next steps are to add a new Inputtype (email to/cc/bcc). Making it possible to submit the form anonymously with a Inputfield and as a form setting.

Reply to "Added a second database table, changed mail body filled with form data"
Return to "CIForms" page.