reCaptcha V2 Manual upgrade steps

Did you also configure the values in config.inc.php?

The recaptcha_version setting will need to be changed to “2”, and you will probably need a new reCaptcha key pair, at the least.

That is exactly what i was missing :slight_smile:
Thank you so much!

@jcanning can you explain where file and what code you add more detail?
I cannot find file classes/form/validation/FormValidatorReCaptcha.inc.php on OJS 2.4.8.1

There are two different pulls, with two different bases: the OJS application, and the shared library (which lives under the OJS application in lib/pkp). The FormValidatorReCaptcha.inc.php file is in the shared library, so the full path is:
lib/pkp/classes/form/validation/FormValidatorReCaptcha.inc.php

Hi Andrew,

these are all the files i backed up and modified.

Replaced the following files with updated versions for the OJS website

  • /public_html/lib/pkp/classes/form/validation/FormValidatorReCaptcha.inc.php
  • /public_html/lib/pkp/classes/notification/form/NotificationMailingListForm.inc.php
  • Added: /public_html/lib/pkp/classes/notification/form/NotificationMailingListForm.inc.php.swp
    ****Not sure if this one was needed but put it there anyways
  • /public_html/classes/comment/form/CommentForm.inc.php
  • /public_html/classes/user/form/RegistrationForm.inc.php

File updated to include the option for reCaptcha v2
/html_public/Config.inc.php

Hope this helps.

Thanks,
jAC

The .swp file is not needed and was removed in this subsequent commit:
https://github.com/pkp/pkp-lib/commit/367644685074f20974aa32b6e0c83a9048526bbf

1 Like

Great post. Very helpful.
Thanks

Hey All,

I ran into a small hiccup when a user tries to register now

Fatal error: Class ‘PKPString’ not found in /home/username/public_html/classes/user/form/RegistrationForm.inc.php on line 372

Any thoughts on why that might be barking (i mean i know it cannot find that class but it was a complete replacement of the file)?

Thanks,
jAC

Hi @jcanning,

There’s a reference in classes/user/form/RegistrationForm.inc.php to the PKPString class, which should be to String in your version of OJS. You should be able to change that and it’ll work.

I’ll review whether the wrong name got committed to the stable codebase by accident and change it if needed.

Regards,
Alec Smecher
Public Knowledge Project Team

I’ve successfully installed recaptcha v2 on ojs2.4.8-1. Woo-hoo!

However, from some initial tests it seems that the recaptcha v2 form always validates with no checks. I’m just checking the I’m not a robot box and it passes.

Follow up:

I’ve tested on Chrome and Firefox: always passes.
Safari: works as expected.

I have been trying to do this on my website bjohns.in but without success. Could you please help me? New users are not able to register as the recaptcha ver 1 has expired. Please help.

I have been trying to do this on my website bjohns.in but without success. Could you please help me? New users are not able to register as the recaptcha ver 1 has expired. Please help.

The most straightforward way to handle this is to do the standard upgrade to OJS 2.4.8-3, and then edit the config.inc.php settings with your new settings and keys. This will enable ReCAPTHA v2 for registrations and comments (notification mailing list subscriptions is broken).

To fix notifications mailing lists will take the patch described here:

Do you use ReCAPTCHA for notification mailing list subscriptions?

Thank you ctgraham. I updated with ssh patching to ojs 2.4.8.3 and then replaced the files in those two pull requests (the lib pkp files were the same, the class comment and registration form files were different probably) and it is working now.

@ctgraham will a 2.4.8-4 be available with the patch to fix broken mailing list notifications?

Also when updating a system from 2.4.8-1 to 2.4.8-3 that has modifications made to it for other bugs or tweaks, what is the best way to detect/patch/include/exclude those inhouse patches we have made? Thanks.

Yes, I think we should schedule a new release of OJS 2.4.8. @asmecher would be the one to greenlight and implement this (or to point out the reasons to defer).

To maintain your local change, I strongly recommend leveraging version control, such as Git, mercurial, or Subversion.

At Pitt, we maintain feature branches within GitHub for each local change which we aren’t pushing back up to the core code. Upon upgrade, re-applying our locals is as simple as merging each feature branch, checking for any conflicts which may have been introduced.

Guess I have some learning to do about revision control!

If you deal at all with code changes, it will be one of the best time investments you can make.

I have the same issue, what to change here?