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

    I've recently started working with MODX and have gotten into quite good speed. However, here is one issue that I cannot figure out and thought to ask here for some tips.

    Basically what I'm trying to do is a "intranet"-site, accessible anywhere. It's currently running on Modx Cloud, and I've got most of the stuff working. However, I'd like to restrict access to the whole site to members only. So the flow would go something like this:

    1) User comes to the site and just sees the login form
    2) Users logs in and gets to the main site
    3) The site has a link to manager, which users can access

    So what are the steps needed to achieve this? I've tried several things found online, but can't seem to get the pages protected, visible to all logged in users and login to go to main page instead of the manager to all to work simultaneously.

    Secondary, are there any ready plugins that would directly allow commenting on e.g. articles as logged in users. So that when members login, they can comment articles by just writing comment and pressing send, as users are logged in and system already knows their username/etc.

    Thanks a lot!


    • MODX Version: 2.3.1
    • PHP Version: 5.4.31
    • Database (MySQL, SQL Server, etc) Version: MySQL 5.6.16-64.2-56
    • Installed MODX Add-ons: Archivist, articles, breadcrumbs, codemirror, fastfield, formit, gallery, getfeed, getpage, getresources, login, quip, sitemapfriend, taglister, tinymce, ultimateparent, wayfinder
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Your landing page should be unprotected, or at least will need to have load, list, view for the "anonymous" user. It should also be your "unauthorized" page (system setting).

      The other resources will all be protected, with the Login snippet providing access. Your users can be given access to both the web and the mgr context. I use a weblink resource to provide a link to the Manager in the main menu when I'm developing a site.

      Any of the commenting snippets - I'm particularly fond of ModxTalks - can be configured to allow members of a group to post comments.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 48597
        • 3 Posts
        Thanks for the reply.

        Would it be possible to get more details on how to set this up? I really can't seem to get this to work.

        I've tried to setup resource groups with different permissions, adjust the web context permission, even creating new context, but just can't get the page to work. I have a separate login page, and have set the unauthorized page to that, but no auto-redirection happens. Either anonymous can access the protected page or they get 503 error. Any detailed information for this would be highly appreciated.

        Thanks!
          • 48597
          • 3 Posts
          I ended up fixing this just by adding a snippet to the base templates, that checks if user is logged in and redirecting to the login page if not. Something along these lines:

          https://forums.modx.com/thread/?thread=44828&page=1