gio1961 Posted March 21, 2018 Report Share Posted March 21, 2018 (edited) Hi guys, did someone re-use how to intervene on the ReCaptcha code of the old phpvms Version 2.1.936 version? (page contact, registration) if yes, how? thanks for a possible answer.if yes, how? thanks for a possible answer Edited March 21, 2018 by gio1961 Quote Link to comment Share on other sites More sharing options...
youngbuckscrew Posted March 21, 2018 Report Share Posted March 21, 2018 There is a package with composer which is very easy to integrate with your forms. https://github.com/anhskohbo/no-captcha If this is what you are referring too. If not explain further and i might be able to assist you. Quote Link to comment Share on other sites More sharing options...
gio1961 Posted March 21, 2018 Author Report Share Posted March 21, 2018 Thank you for answering. I refer to the registration page, contacts. I use the 2.1.936 phpvms version. I'm not a professional webmaster but a simple amateur. Best regards Quote Link to comment Share on other sites More sharing options...
youngbuckscrew Posted March 21, 2018 Report Share Posted March 21, 2018 Gotcha! I'll have the older version installed sometime tonight or tomorrow and see how i can help others with the same issue. Quote Link to comment Share on other sites More sharing options...
gio1961 Posted March 22, 2018 Author Report Share Posted March 22, 2018 9 hours ago, youngbuckscrew said: Gotcha! I'll have the older version installed sometime tonight or tomorrow and see how i can help others with the same issue. Thank you for your interest. Best regards Quote Link to comment Share on other sites More sharing options...
gio1961 Posted March 23, 2018 Author Report Share Posted March 23, 2018 15 hours ago, youngbuckscrew said: Okay this is one way of upgrading to v2 of recaptcha. Go here https://github.com/google/recaptcha and scroll down to Direct Download (assuming you don't use composer) and download the package. Once downloaded insert it into: core/lib/recaptcha-master Once you have done this go to core/modules/registration/registration.php # Replace or comment out require_once CORE_LIB_PATH.'/recaptcha/recaptchalib.php'; # With require_once CORE_LIB_PATH.'/recaptcha-master/src/autoload.php'; In that same file, scroll down to VerifyData # Replace all code relating to captcha check with // start the error array as false, we dont have any errors yet. $error = false; // set the configurations for the service to work. $secret = Config::Get('RECAPTCHA_PRIVATE_KEY'); $remoteIp = $_SERVER["REMOTE_ADDR"]; $gRecaptchaResponse = $_POST['g-recaptcha-response']; $recaptcha = new \ReCaptcha\ReCaptcha($secret); // Call the google service and verify the answer provided. $resp = $recaptcha->verify($gRecaptchaResponse, $remoteIp); // If Response was a success if ($resp->isSuccess()) { // No errors; continue $this->set('captcha_error', ''); } else { // Set error as true and show error on front-end $error = true; $this->set('captcha_error', true); } And finally on your registration_mainform.tpl <div class="g-recaptcha" data-sitekey="<?php echo Config::Get('RECAPTCHA_PUBLIC_KEY'); ?>"></div> <script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl=en"> </script> <!-- Recaptcha V2 --> <?php if($captcha_error == true) echo '<p class="error">Please verify you are human!</p>'; ?> you can make a function for that like v1 but that's up to you. Let me know if this helps you! Resolved, thanks. Best regards Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.