Registration doesn't work after enabling ReCaptcha

Hi!
I have a server installed with OJS 3.1.2-1. In order to increase security in my environment I enabled ReCaptcha in config.inc.php just by setting recaptcha = on, adding recaptcha keys, and captcha_on_register = on.

I try to register once and it worked perfectly. But now I’m trying to register again and I only get an Error 500.

This is my ojs log when I’m trying to register:
[Wed Nov 06 09:08:40.352818 2019] [php7:warn] [pid 56138] [client 192.168.128.73:5278] PHP Warning: Declaration of RegistrationHandler::validate($request) should be compatible with PKPHandler::validate($requiredContexts = NULL, $request = NULL) in /home/ojs/lib/pkp/pages/user/RegistrationHandler.inc.php on line 19, referer: https://erevistas.publicaciones.uah.es/

[Wed Nov 06 09:08:40.367964 2019] [php7:warn] [pid 56138] [client 192.168.128.73:5278] PHP Warning: Declaration of RegistrationForm::validate() should be compatible with Form::validate($callHooks = true) in /home/ojs/lib/pkp/classes/user/form/RegistrationForm.inc.php on line 21, referer: https://erevistas.publicaciones.uah.es/

[Wed Nov 06 09:08:40.462109 2019] [php7:error] [pid 56138] [client 192.168.128.73:5278] PHP Fatal error: Uncaught Error: Call to a member function getId() on null in /home/ojs/plugins/generic/orcidProfile/OrcidProfilePlugin.inc.php:253\nStack trace:\n#0 /home/ojs/plugins/generic/orcidProfile/OrcidProfilePlugin.inc.php(289): OrcidProfilePlugin->buildOAuthUrl(‘orcidAuthorize’, Array)\n#1 /home/ojs/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_filterhandler.php(63): OrcidProfilePlugin->registrationFilter(’\trunFilter(‘output’, '\trender(false, 1)\n#4 /home/ojs/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(134): Smarty_Internal_TemplateBase->_execute(Object(Smarty_Internal_Template), NULL, 'fe8 in /home/ojs/plugins/generic/orcidProfile/OrcidProfilePlugin.inc.php on line 253, referer: https://erevistas.publicaciones.uah.es/

I’ve tried going back my config.inc.php by configurating recaptcha = off, commented recaptcha keys, and captcha_on_register = off, but error 500 persists.

I’ve found out that if you are in the main page https://erevistas.publicaciones.uah.es/:

and you try to register, then url becomes “https://erevistas.publicaciones.uah.es/index.php/index/user/register
and it doesn’t work:

However, if you log into the system with a registered user, you edit a journal called rev1:

and then log out, it appears another screen with url " https://erevistas.publicaciones.uah.es/index.php/rev1/login" (notice now it adds “rev1” to the url):

If you try to register on that screen, url becomes “https://erevistas.publicaciones.uah.es/index.php/rev1/user/register” and then it works:

I don’t know if it’s a normal functioning of OJS or there’s something wrong.

I’ll be so thankful if you could help me.
Thanks in advance.
Regards.

Hi @rmga,

The issue isn’t with recaptcha, it’s with ORCID. Did you also recently upgrade, perhaps? Are you using the latest version of the ORCIDprofile plugin?

Cheers
Jason

Hi jnugent,

sorry, I was re-editing my message when you answered my question.
Please, I’d appreciate if you could read the end of my question to see what I found out about the issue.

I haven’t upgraded the system at all.
Thanks so much!
Regards.

Hi @rmga,

Can you try disabling the ORCID profile plugin temporarily to see if that lets you register?

Cheers
Jason

How can I do that?
Cheers.

As journal manager, you can go to Settings -> Website -> Plugins tab and uncheck the box for the ORCID profile plugin. It is in the “Generic” category.

Cheers
Jason

Hi,
Effectively, If I disable ORCID profile plugin I can register without problem.
But I understand I need it enabled. What can I do?
Thanks.

Since you’re using OJS 3.1.2, I’d go and get the newest version of the 3.1.2 plugin here:

You’ll need to upload it onto your server and replace the plugins/generic/orcidProfile directory. You can run php lib/pkp/tools/installPluginVersion.php plugins/generic/orcidProfile/version.xml to install it.

Cheers
Jason

Finally, my problem was a wrong configuration in config.inc.php. My public_files_dir variable wasn’t relative and it was giving me more troubles such as not to upload images, not to show images already uploaded.
Thanks so much for your help.
Regards.

Hi @jnugent ,
I thought my problem registering users was solved but It seems not to work yet.
You told me to upgrade ORCID plugin and I uploaded the orcidProfile directory and replaced mine. But now I get a mistake when I run php command:

[root@revistas_ojs ojs]# php lib/pkp/tools/installPluginVersion.php plugins/generic/orcidProfile/version.xml
PHP Fatal error: Cannot declare class OrcidProfilePlugin, because the name is already in use in /home/ojs/plugins/generic/orcidProfile/OrcidProfilePlugin.inc.php on line 1202

Do you know what it’s happening?
Thanks a lot.
Regards.

Are you sure you replaced your Orcid plugin and did not perhaps create another directory or sub directory? Did you remove the original directory, first?

Cheers,

Effectively I had renamed my orcidProfile directory and I hadn’t removed it.
Now when I run the php command it says:
[root@revistas_ojs ojs]# php lib/pkp/tools/installPluginVersion.php plugins/generic/orcidProfile/version.xml
PHP Warning: Invalid argument supplied for foreach() in /home/ojs/lib/pkp/classes/plugins/Plugin.inc.php on line 646
I still have “http error 500” in my screen when you try to register.
I got the plugin from:



Thanks.
Regards.

That warning won’t cause the 500 error you’re seeing, so there will still be a “fatal error” in your log when you access that page.

Cheers,
Jason

And actually, how did you download the plugin from the git repository? Did you actually get the stable-3_1_2 branch? Usually, I do a git clone and then a git checkout stable-3_1_2 to make sure I’m on the correct branch.

Cheers,

It’s my first time installing plugins, so I don’t know how to do it very well. I downloaded the zip file from the url I mentioned (with branch: stable-3_1_2).
I saw there was another way “open in Desktop”. Is it better? What way do you use?
Thanks!

That should be fine then. Can you look in your Apache error log for the fatal error I think you’ll find?

Cheers,

Here you are the log when I try to register:
[Wed Nov 20 09:20:34.162795 2019] [php7:warn] [pid 7423] [client 192.168.128.73:51464] PHP Warning: Declaration of CustomBlockPlugin::getBlockContext() should be compatible with BlockPlugin::getBlockContext($contextId = NULL) in /home/ojs/plugins/generic/customBlockManager/CustomBlockPlugin.inc.php on line 134, referer: https://erevistas.publicaciones.uah.es/
[Wed Nov 20 09:20:34.182981 2019] [php7:warn] [pid 7423] [client 192.168.128.73:51464] PHP Warning: Declaration of RegistrationHandler::validate($request) should be compatible with PKPHandler::validate($requiredContexts = NULL, $request = NULL) in /home/ojs/lib/pkp/pages/user/RegistrationHandler.inc.php on line 19, referer: https://erevistas.publicaciones.uah.es/
[Wed Nov 20 09:20:34.198157 2019] [php7:warn] [pid 7423] [client 192.168.128.73:51464] PHP Warning: Declaration of RegistrationForm::validate() should be compatible with Form::validate($callHooks = true) in /home/ojs/lib/pkp/classes/user/form/RegistrationForm.inc.php on line 21, referer: https://erevistas.publicaciones.uah.es/
[Wed Nov 20 09:20:34.326562 2019] [php7:error] [pid 7423] [client 192.168.128.73:51464] PHP Fatal error: Uncaught Error: Call to a member function getId() on null in /home/ojs/plugins/generic/orcidProfile/OrcidProfilePlugin.inc.php:256\nStack trace:\n#0 /home/ojs/plugins/generic/orcidProfile/OrcidProfilePlugin.inc.php(292): OrcidProfilePlugin->buildOAuthUrl(‘orcidAuthorize’, Array)\n#1 /home/ojs/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_runtime_filterhandler.php(63): OrcidProfilePlugin->registrationFilter(’\trunFilter(‘output’, '\trender(false, 1)\n#4 /home/ojs/lib/pkp/lib/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(134): Smarty_Internal_TemplateBase->_execute(Object(Smarty_Internal_Template), NULL, 'fe8 in /home/ojs/plugins/generic/orcidProfile/OrcidProfilePlugin.inc.php on line 256, referer: https://erevistas.publicaciones.uah.es/

So, it’s this line here that is generating the fatal error:

The $context object is null.

When you’re trying to register, are you registering within a journal, or site wide in OJS?

Cheers,
Jason

If I register within a journal, it works. The issue appears when you try to register in the main screen:

and I checked if I disabled ORCID plugin in general settings, it worked too.

So, this may be a bug in the plugin. The plugin does require a context (journal) object in order to work and it shouldn’t either run/generate the fatal error when registering at the site level. I’ll do some investigating but in the mean time you may want to disable the plugin to prevent errors.

Cheers,