Recaptcha error - ReCaptcha\ReCaptcha Class not found

rl2rl2
edited March 2018 in News & Announcements
Hello,

Okay first off this is running on localhost so I get a javascript alert: Cannot contact reCAPTCHA. Check your connection and try again.

Now, if I complete the form; ignoring the Recaptcha and hit submit I get the following error. Where can I find the Recaptcha Class?

-------

( ! ) Fatal error: Class 'ReCaptcha\ReCaptcha' not found in /vagrant/html/local.fuel.co.uk/fuel/modules/forms/helpers/forms_helper.php on line 148

A PHP Error was encountered
Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /vagrant/html/local.fuel.co.uk/fuel/modules/forms/helpers/forms_helper.php:148)

Filename: core/Common.php

Line Number: 578

Backtrace:

A PHP Error was encountered
Severity: Error

Message: Class 'ReCaptcha\ReCaptcha' not found

Filename: helpers/forms_helper.php

Line Number: 148

Backtrace

Comments

  • edited 6:58PM
    See these issues on GitHub for more references:
    https://github.com/daylightstudio/FUEL-CMS-Forms-Module/issues/13
    https://github.com/daylightstudio/FUEL-CMS-Forms-Module/pull/15

    Sounds like you'll need the vendor package installed with composer.
  • rl2rl2
    edited 6:58PM
    Well that's one thing solved.

    The next problem is that if I complete the form, but ignore the Recaptcha I can still submit the form! How do I tell Fuel/CodeIgniter that the Recaptcha is mandatory?
  • edited 6:58PM
    The Forms_custom_fields.php file has a recaptcha method in it which is used to render the recaptcha form field. In that method it has a line used to validate the recaptcha on post process:
    $validator->add_rule("recaptcha_response_field", "validate_recaptcha", "'.$params['error_message'].'", array("'.$params['recaptcha_private_key'].'"));
    The "validate_recaptcha" is a function that is in the forms_helper.php file and will return a TRUE boolean value if it is valid. My guess is that there needs to be some adjustment there.
Sign In or Register to comment.