-
- 932 Posts
Yeah i dont think theres an easy way around it you'll need to write your own hook based on the documentation
https://developers.google.com/recaptcha/docs/verify
-
- 1,118 Posts
Any one willing to take on this fix? I just don't have the PHP skills to sort it! "reCAPTCHA V1 has been deprecated since May of 2016 and will no longer work from end of March 2018"
-
- 54 Posts
dubbs, no, I was busy with other work and projects, and was hoping a native fix would be released at some point well before quip with recaptcha would start to fail, march 31. I'm just checking back now, and clearly the issue is not resolved. If it were, we'd see a new quip being offered but that's not the case.
I read a bit of the google docs, but in order to master both the recaptcha v2 logic, which is very different from v1, and quip, would require a fairly substantial time investment on my part, and it wouldn't even be guaranteed to work. Probably, but not for sure. Speaking for myself, the reason I use a CMS like modx is specifically so I don't have to write the solutions to such problems, and can just work on the site etc, and not worry about the guts running it.
My suspicion is that the only person who understood quip code left the project quite a while ago, and has no interest in supporting quip in modx, for whatever reason, and nobody else has stepped in to fill the gap, which is a real problem for what I would view as a core modx package. Obviously this should have been done at least 1 year ago.
It's possible the existing hooks in other form things in modx can be studied and then a rewrite of quip could be done to try to integrate that, but it's not easy if you're not familiar with the modx internal code, quip internal code, and hooks into it via recaptcha2. This is really something people who work on the code of modx should be doing, since they already have a lot of that knowledge and understanding. But that's not happening apparently, though it should be, so I'm still hoping someone takes an interest and resolves the issue.
-
- 932 Posts
The quip reply snippet supports both pre and post hooks so there's nothing stopping you from writing your own code to work with recaptchav2 - check google documentation. Quip originally handled recaptcha in a different way that wasn't reliant on pre and post hooks, which maybe it should have done in retrospects, but it can be disabled and then your own validation snippet worked in.
I wouldn't say it is down to the MODX core team to write the code for you though, if it is something you want but don't have the skillset to provide then you should consider hiring someone to develop it for you.
-
- 932 Posts
This works in terms of checking validations and allowing the user to post or not but you'll need to modify it to throw back your own error and also when its posting its not sending the comment so you'll need to play around with it to work properly.
In your quipaddcomment.chunk.tpl you need to add this in replacement of quip (or if you're not using the recaptchav2 then use the supplied code from google):
In your QuipReply call add in the preHook 'recapHook'
[[!QuipReply? &thread=`[[*pagetitle]]` &preHooks=`recapHook` ]]
In recapHook snippet place this.
<?php
$response = $_POST["g-recaptcha-response"];
$url = 'https://www.google.com/recaptcha/api/siteverify';
$data = array(
'secret' => 'YOUR_SECRET_KEY', // Replace this with your own key.
'response' => $_POST["g-recaptcha-response"]
);
$options = array(
'http' => array (
'method' => 'POST',
'content' => http_build_query($data)
)
);
$context = stream_context_create($options);
$verify = file_get_contents($url, false, $context);
$captcha_success=json_decode($verify);
if ($captcha_success->success==false) {
return false;
} else if ($captcha_success->success==true) {
return true;
}