We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44103
    • 4 Posts
    In my modx site I am managing multiple contexts, as default `web` context is used. Other contexts are responsible to use site in different languages. I am using `login 1.8.1-pl` extra for authentication and snippet call I am using to make me logged in all the contexts:
    [[!login? &... &contexts=`web,Danish,Italian`]]

    The login works fine and shows me looged-in in current context. But when I cahnge context it shows me logged out. But when I clear cookies of my browser it works perfectly. It seems that problem occures when I log out from a context modx only clears cookies for current context but other contexts retain their old cookie values (most importantly PHPSESSID). Is there any way to clear cookie data for all the context when I logout from any context?

      • 22303 MODX Staff
      • 10,725 Posts
      Are you routing to subdomains or subfolders for each Context?
        • 43981
        • 7 Posts
        Quote from: opengeek at Dec 20, 2013, 11:27 AM
        Are you routing to subdomains or subfolders for each Context?

        Routing to subfolders. Main site www.example.com
        German site www.example.com/de
          • 22303 MODX Staff
          • 10,725 Posts
          Then you likely have a custom base_url in each Context. You need to set your session_cookie_path System Setting to / so that you don't get different session cookies for different Context paths. By default, MODX uses the base_url to set the session.cookie_path if you do not specify one in System Settings.
            • 44103
            • 4 Posts
            @opengeek

            Thanks for the reply, it worked perfectly smiley

              • 26503
              • 620 Posts
              I am having exactly the same issue, several contexts routed to subfolders, I came across the cookie path earlier and tried it [because it was defaulting to a path users's should not have access to] but when I add the / if a user tries to log in they get blank pages on the front end!

              here is the post about it in stack exchange:

              http://stackoverflow.com/questions/32080915/modx-revolution-2-3-5-login-snippet-users-are-not-getting-sessions-after-logg/32081024#32081024



              I'm having a strange issue with a new modx site - web users are not getting sessions after logging in. I'm sure they are authenticating correctly but modx does not seem to be setting the session. I think it has something to do with context access.

              I have 3 contexts, web, French & English I have user groups and resource groups which has access to the appropriate contexts.

              here is my login snippett:

              [[!Login? 
                   &loginTpl=`LoginTpl`  
                   &logoutTpl=`LogoutTpl`  
                   &errTpl=`lgnErrTpl`  
                   &loginResourceId=`91`
                   &logoutResourceId=`5` 
                   &contexts=`English,French`
                   ]]


              users are not being granted access to the web resource as it will be used for internal documentation.

              NOW, everything appears to behave normally, if you enter incorrect credentials in the login form, you get a login error. If you enter correct credentials you get forwarded to the correct resource [91] BUT the user does not have a session [[!+modx.user.id]] returns 0 for the anonymous user. AND if I look at my browser cookies, all I have is the default php session cookie and no modx session cookies. curiously, the cookie path is /docs/ which is the base_url for the web context. if I change the cookie path to / in modx then all pages are blank for the user!!

              What is causing the problem here??
                *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

                Sean Kimball CLP, CLS.
                Technical Director / Sr. Developer | BigBlock Studios
                ._______________________________________________.
                Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
                27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
                phone/fax: 905-426-5525