Captcha for login page

Hello,

I would like to add captcha to login page (using ver 2.4.3). I edited the \lib\pkp\templates\user\login.tpl file by copying captcha html code from \templates\user\register.tpl but I can’t find the .php file that handle the page and what code should I copy from. I also edited the config.inc.php file to set captcha and recaptcha on.

Am I doing right thing? Or should I do anything other than those?

Thank you.

The other instances of CAPTCHA/reCAPTCHA use an explicit form class. For example, see numerous references in:

and

I don’t think 2.4.3 uses a specific form class for login, so similar changes would need to be made directly in the login handler:

@ctgraham I have made a change like this but it seems like post validate doesn’t work, could you take a look at the file? The captcha is showing though… It just doesn’t validate :slight_smile:

https://github.com/pkp/pkp-lib/blob/ojs-2_4_3-0/pages/login/PKPLoginHandler.inc.php

Can you confirm your server settings as below:

allow_url_fopen = On

This setting is required by this feature.

Regards,

I’m sorry what setting is this? I’m pretty new to open source things like this

This settings are in server. So you need to confirm with your server administrator.

Regards,

Thank you. I’ll try to contact them first for now :slight_smile:

If CAPTCHA/ReCAPTCHA does not work both on the Registration page (per the PKP code) and on the Login page (per your code), the problem is likely a server setting. If the Registration page works, but Login does not, the problem is likely in your code.

The best way to share your code is to commit it to GitHub and then provide a link to the commit or to the branch with the commit here.