How to add Recaptcha to the login page? OJS 3.1.2

Hi, I’m trying to put the recaptcha that appears on the registration page on the login page. I have seen many topics like this that have helped me identify some key files to do what I want, but I have not succeeded.
I am using OJS 3.1.2. I’ve already been looking at the files RegistrationForm.inc.php, LoginHandler.inc.php, userLogin.tpl

From RegistrationForm.inc.php I copied the following code
if ($ this-> captchaEnabled) {
$ publicKey = Config :: getVar (‘captcha’, ‘recaptcha_public_key’);
$ reCaptchaHtml = ’

';
$ templateMgr-> assign (array (
‘reCaptchaHtml’ => $ reCaptchaHtml,
‘captchaEnabled’ => true,
));
}
and I copied it into the index() method of LoginHandler to assign it to the userLogin template
and from userRegister.tpl I copied the code showing the recaptcha and pasted it into userLogin.tpl
{if $ reCaptchaHtml}

{$ reCaptchaHtml}
{/ if}

but it does not show me anything, when I inspect the page I see that the html code of the recaptcha is on the page but it is not displayed. What am I missing?

Please someone help me with this … I am urged … I keep getting the same results…

Hi @yusmelvis,

It’s implemented in OJS 3.3.0.

Thanks @Vitaliy, but right now it is impossible for me to migrate from OJS 3.1.2 to 3.3.0 maybe later. Could you guide me how to make the change in my OJS version? Do you think that maybe seeing how they do it in OJS 3.3.0 I can achieve it in my current version?

Sorry, it’s not back-ported to stable 3.3.0 branch and not yet released.
You can take a look at this issue: Optionally require reCaptcha during the login · Issue #6539 · pkp/pkp-lib · GitHub, to be more precise, PRs to pkp-lib and OJS that are referenced there.

Sorry @Vitaliy , but I’m a bit lost with the conversation I see on Optionally require reCaptcha during the login · Issue #6539 · pkp/pkp-lib · GitHub. I’m not sure where I can find the final changes to make to get the recaptcha on the login page. Could you give me the direct link? Sorry for the inconvenience and thanks in advance…

PR to shared library: Closes pkp/pkp-lib#6539 Extended reCaptcha to the login page. by jonasraoni · Pull Request #6541 · pkp/pkp-lib · GitHub
PR to OJS: Closes pkp/pkp-lib#6539 Extended reCaptcha to the login page. by jonasraoni · Pull Request #2981 · pkp/ojs · GitHub