We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22969
    • 158 Posts
    Hey,

    I have set-up Login in its simplest form, what im trying to do is allow staff to login and view a generic secure staff page with information, nothing more, so do i need the login to redirect to the page in question after login?

    Is there a way to setup login to do this?

    At the moment when i login its stays on the same resource/page with just a logout link.

    Thanks

    Brett
      • 22446
      • 181 Posts
      Peekaboo,

      To redirect the login snippet to a different page all you need to do is include the following code in your login snippet.

      &loginResourceId=`163`


      Replace 163 with the id of the page you want to redirect to. More information on the login snippet can be found here http://rtfm.modx.com/display/ADDON/Login

      Hope this helps.
        • 22969
        • 158 Posts
        Me again!

        I have done the above but I have realised it wont be as simple as I first thought, ill try and explain what I need to to do!

        Staff go to a page called "Staff Area" once there is the login form, they login and the same page loads back up with the content that they can now access with a logout link along the top (the reason i assume needs to be the same page throughout, if possible, is because the link in the main navigation just goes to "Staff Area" page so if they visit other aspects of the website they can still get back to the "logged in" page.

        Does that make sense?

        Can someone help by explaining on how to achieve that?

        I have looked through the wiki but im a bit confused by it.

        Thanks
        Brett
          • 22969
          • 158 Posts
          anyone got any ideas?

          Cheers
          Brett
            • 16633
            • 116 Posts
            I had a similar issue and solved it one way but I am sure there are many ways to solve it.

            So when the user logs into the secure page I had links to other pages but as you noticed if they go to a diff page, they can’t get back. So I use the personalize addon and if they are logged in I show a different navigation, if they are not logged in I show the default public navigation. I also do this with the sidebar. This way when they are logged in they only see secure pages.
              --
              Landon Poburan
              Web Designer and Developer

              http://www.categorycode.ca
              http://www.landonp.com
              • 3749
              • 24,544 Posts
              There is also &redirectToPrior=`1`

              In that case, you put a snippet with a redirect on the user’s page that sends them to the login page if they’re not logged in and, on successful login, they get sent back.
                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
                • 22446
                • 181 Posts
                BobRay,

                Is there a snippet out there that would redirect them to the login page if they are not logged in? I would like to implement this, but I am not sure where to start.
                  • 28215
                  • 4,149 Posts
                  The Login package comes packaged with a [[!isLoggedIn]] snippet that does just that.
                    shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                    • 22446
                    • 181 Posts
                    Shaun,

                    How do I implement the [[!isLoggedin]] snippet? Do I include it on each page that is protected?

                    Right now I have tried to place the snippet in my protected pages with no luck. If I visit the protected pages it redirects me to my error 404 page.
                      • 28215
                      • 4,149 Posts
                      It will redirect you to the unauthorized_page if you’re not logged in. Check to see what the unauthorized_page setting is set to.
                        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com