We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8168
    • 1,118 Posts
    Quote from: mediengaarage at Feb 27, 2018, 03:54 PM
    I tried both &recaptcha=`1`and &recaptcha=`0` but both are not working.

    When you say it doesn't work - I assume you mean the validation fails? if its set to 0 then it wont check it at all - with it set to 1 it checks it - but always fails it for me - even if recaptcha has been successfully ticked. Is this the same behavior you see?

    From this - I assume the recaptchaV2 addon for MODx is not passing a 'validated correct' flag to quipReply to successfully complete the form...?

    Anyone any ideas???
      • 17301
      • 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
        ■ email: [email protected] | ■ website: https://alienbuild.uk

        The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
        • 8168
        • 1,118 Posts
        Quote from: lkfranklin at Feb 27, 2018, 04:15 PM
        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

        The recaptchaV2 addon must already have this as it works for Formit - https://modx.com/extras/package/recaptchav2 - I guess the bit missing is the specifics for passing back the 'validation is confirmed' flag to quip... Anyone able to adapt Quip to allow this to work??? big please!!!
          • 8168
          • 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"
            • 17284
            • 54 Posts
            https://developers.google.com/recaptcha/docs/faq

            Any calls to the v1 API will not work after March 31, 2018. Starting in November 2017, a percentage of reCAPTCHA v1 traffic will begin to show a notice informing users that the old API will soon be retired.

            I'm bumping this thread since the expire date for the working V1 recaptcha is now 4 weeks or so away.

            I was somewhat dismayed to learn that the original modx quip author has moved on, and his github won't accept issues for quip.

            Technically we could just disable recaptcha I guess, and rely on manual post approval, but it would be nice to be able to switch over to recaptcha v2 in the next few weeks, seamlessly.

            I'm just posting this as a bump to remind that there is a clock ticking here, and it's about to run out, at which point all the quip installs in the world in modx, which I assume are a non trivial number, will fail if they use recaptcha. This is not desirable.
              • 17284
              • 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.
                • 17301
                • 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.
                  ■ email: [email protected] | ■ website: https://alienbuild.uk

                  The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
                  • 17301
                  • 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):

                  [[recaptchav2_render]]


                  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;
                  }
                  

                    ■ email: [email protected] | ■ website: https://alienbuild.uk

                    The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
                    • 8168
                    • 1,118 Posts
                    Thanks @LK - The creator of recaptchaV2 has also issued a new version last night (https://github.com/sepiariver/recaptchav2), following a chat I had with him re: the need for it to work with quipReply which hopefully might also work... need to test these 2 new approaches today...

                    Will post back once I have had time to have a play...
                      • 8168
                      • 1,118 Posts
                      @LK - OK great - yes, this snippet you have created validates the recaptchav2 well - no error message as you say - how could the snippet be adapted to include that?

                      And yes - no data of the comment is passed which is rather a major issue... any ideas how it can be fixed so that the quip comment data is sent?

                      The quipReply snippet PHP is here > https://github.com/splittingred/Quip/blob/develop/core/components/quip/elements/snippets/snippet.quipreply.php < means nothing to me as I don't know PHP - but assume somewhere in that is the code to pass the form fields to the Quip back-end? Can we copy from this to the new snippet you have made so the data comes with it on form submission? [ed. note: dubbs last edited this post 6 years, 2 months ago.]