On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Hello,

    I'm using MODX Revolution 2.6.4-pl and the Login Snippet in combination with the RecaptchaV2 snippet. The Login-Chunk is in right sidebar and always visible.

    After activation of the recaptcha it's not possible to logout. I'm getting always this error: Please select the checkbox in the ReCaptcha image.

    If I delete the &preHooks Parameter in the snippet call, the I can logout.

    What could be wrong?

    Best regards
    Andre

    This question has been answered by BobRay. See the first response.

    • Try removing the ReCaptcha code from the logout Tpl chunk.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
      • Hello BobRay,

        thanks for your reply.

        In my logoutTpl chunk is no Recaptcha code.
        For testing I tried the original lgnLogoutTpl chunk which is like this:

        <div class="loginMessage">[[+errors]]</div>
        <br />
        <div class="loginLogin">
            <div class="loginRegister">
                <a href="[[+logoutUrl]]" title="[[+actionMsg]]">[[+actionMsg]]</a>
            </div>
        </div>


        It leads to the same result. I can not log out.

        The snippet adds a ?service=logout to the link above. No form data will be send and there should be no reason to check the recaptcha.

        My snippet call is like this:

        [[!Login? &tplType=`modChunk` &loginTpl=`lgnLoginTpl` &logoutTpl=`lgnLogoutTpl` &logoutResourceId=`1` &errTpl=`lgnErrTpl` &errTplType=`modChunk` &preHooks=`recaptchav2`]]


        It's inside another chunk and always visible in the right sidebar. As far as I know the logout link should refer to the same page that contains the Login snippet call. The snippet switches between logoutTpl and loginTpl depending if the user is logged in or not.

        I have no idea.

        Best regards
        Andre
        • discuss.answer
          I'm guessing that if the Login snippet tag is on that page, the ReCaptcha snippet is going to run and will call the reCaptcha preHook (though it shouldn't if the user is logged in), which will prevent the forward. Looking at the ReCaptcha snippet, it never checks the user's login status, so the Login snippet would have to know enough not to run that preHook if the user is logged in. Make sure your Login package is the current version.

          Also, double-check to make sure the user has logout permission.

          Some possible solutions if the problem persists.

          1. Create two versions of the the Login snippet tag, one with the preHook and one without it. Put them in separate chunks and use the Personalize snippet to show the appropriate one. IOW, show the one without the preHook to logged-in users.

          2. Make the logout link point to a page with just the login snippet tag, but without the preHook. To do that, change the &logoutResourceId to that page's ID.

          [update] The old recaptcha hook doesn't do any checks if the user is logged in, I've suggested that the ReCaptchaV2 snippet do the same.
          [ed. note: BobRay last edited this post 11 months, 4 weeks ago.]
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
          • Hello BobRay,

            thanks a lot for your help.

            I followed your suggestion and created two separate chunks. Together with the Personalize snippet it works as expected. Log out is possible.

            Best regards
            Andre




            • I'm glad you got it sorted. smiley
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting