We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9241
    • 42 Posts
    I’ve recently came across a scenario where I wanted to pull out my hair again and realized I might have stumbled upon a problem within the Login package.

    What happened is that I could login using it on the website we are developing, but was unable to logout, as this would result in an error page where it stated it was unable to redirect. I traced it to the piece of code:
    $modx->sendRedirect($_SERVER['REQUEST_URI']);


    I changed this to redirect to the front page by default when you logout, but this in effect caused me not being able to logout from the front end of the site.

    Then I proceeded to logout of the manager, and in a last attempt decided try logging out again on the front end, and it worked. I logged in again, and logged out, logged in, and then also logged into the manager, tried logging out on the front end and then I got the error. As soon as I logged out from the manager I was able to log out on the front end again.

    For some reason when the same user is logged in on both the mgr and web context (maybe multiple contexts to keep it generic) then the Login package didn’t want to logout the web context user and proceeded to through an error.

    We are currently using modx 2.0.2-pl (will in this week be upgrading to 2.0.4) as well as Login 1.3.1-pl.
      • 16633
      • 116 Posts
      I have come across this issue as well.

      I have a login page which redirects you to a members only page. Once you are on the members on page I call the snippet again to display the logout but (which it does) but then when you click it, it does not log you out.

      Landon
        --
        Landon Poburan
        Web Designer and Developer

        http://www.categorycode.ca
        http://www.landonp.com
        • 16633
        • 116 Posts
        I found that the logout didn’t work when it was in a chunk but when I put the [[!Login]] call in the main content it worked...
          --
          Landon Poburan
          Web Designer and Developer

          http://www.categorycode.ca
          http://www.landonp.com
          • 9241
          • 42 Posts
          Quote from: landonpoburan at Oct 27, 2010, 04:31 PM

          I found that the logout didn’t work when it was in a chunk but when I put the [[!Login]] call in the main content it worked...

          Interesting... our setup is about the same, where we have chunk with a couple of snippets on the inside, which includes the Login snippet.
            • 22303 MODX Staff
            • 10,725 Posts
            Redirects to REQUEST_URI is bad for IE; IE requires that header redirects include the absolute URL with scheme. I thought this was fixed in the Login snippet though...
              • 9241
              • 42 Posts
              Quote from: OpenGeek at Oct 28, 2010, 08:33 AM

              Redirects to REQUEST_URI is bad for IE; IE requires that header redirects include the absolute URL with scheme. I thought this was fixed in the Login snippet though...

              I haven’t tested it on IE, we mainly use firefox.
                • 16633
                • 116 Posts
                Quote from: OpenGeek at Oct 28, 2010, 08:33 AM

                Redirects to REQUEST_URI is bad for IE; IE requires that header redirects include the absolute URL with scheme. I thought this was fixed in the Login snippet though...

                I was using Chrome when testing. You can see the URL change to ?service=logout when you click it but nothing actually happens.
                I have a login page with the snippet their to login. Then once your logged in I display it again in the sidebar (on the protected page) so they can logout. In the sidebar is where it does not work, but if I go back to the login page where it now displays "logout" (since they are logged in) it works. I am pulling my hair out.
                  --
                  Landon Poburan
                  Web Designer and Developer

                  http://www.categorycode.ca
                  http://www.landonp.com
                  • 271
                  • 3 Posts
                  Hey All -- I had a challenge with this problem too and, after fooling with calling the MODx User ID in the template (just to see if there was a login active or not), I realized that it wasn’t a login/logout problem but a caching problem. When I cleared the cache on my site and disabled caching on pages, everything worked as expected.