We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8471
    • 333 Posts
    Hi, I want to restrict the access to a page (whit a password) for user registered and not.
    How can I do?
    Thanks to all
      Sorry for my bad English grin
      • 25663 MODX Staff
      • 12,272 Posts
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 8471
        • 333 Posts
        I want to protect a page whit a password for all users! also for users who weren’t registered, so I can’t use webgroups...
          Sorry for my bad English grin
          • 25663 MODX Staff
          • 12,272 Posts
          You’ll need to either use .htaccess or to create a custom snippet to do that, then.
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 1764
            • 680 Posts
            This sounds like a good candidate for a plugin if anyone wants to write it.

            I’d suggest associating a password with a document group and the plugin would overwrite the content with a password form for any document in that group.

            I wouldn’t mind writing it but I probably wouldn’t get to it for 6 months the way things are going these days smiley
              • 8471
              • 333 Posts
              Quote from: aNoble at Feb 22, 2006, 12:33 PM

              This sounds like a good candidate for a plugin if anyone wants to write it
              It would be a fantastic idea, I’m not able, but if someone can do it... wink
                Sorry for my bad English grin
                • 32241
                • 1,495 Posts
                Quote from: edipo at Feb 22, 2006, 11:45 AM

                I want to protect a page whit a password for all users! also for users who weren’t registered, so I can’t use webgroups...

                I don’t really get it. How do you password protect a page for unregistered users? I mean how will they have access to the protected page? Sorry, I might need a little bit clarification here.
                  Wendy Novianto
                  [font=Verdana]PT DJAMOER Technology Media
                  [font=Verdana]Xituz Media
                  • 25663 MODX Staff
                  • 12,272 Posts
                  Think emulating an .htaccess password protected directory.
                    Ryan Thrash, MODX Co-Founder
                    Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    The plugin would check for the user being logged in to a special web group; if he’s not (or isn’t logged in at all), replace the [*content*] tag with [!WebLogin!] tags, if he is add the WebLogin tags somewhere convenient to provide a logout link. It depends on your template and if you have a WebLogin form in the sidebar, you could just replace the content with the text "Restricted area. Please login."

                    If he’s logged in already as somebody else who isn’t a member of that group, put a message that they need to log out and log in again as the correct user for that area.

                    Or...if he’s already logged in as somebody else, serialize his existing web login information, save it to a SESSION variable, and clear the web login SESSION variables and continue as above, then he’ll need to login for that area, and next time he logs out (check the GET) trap it and replace the SESSION variables with the serialized data. If he logs out in the restricted area redirect him out of it, if he’s outside the restricted area let the page process normally after the SESSION manipulation.
                      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
                      • 32241
                      • 1,495 Posts
                      Cannot we do this using a web user? I mean we can have one public web user account and assign it to a web group. All the protected pages can be assigned to a specific doc group, and this doc group will be assigned to the web group. That’s all right? Basically the page will be hidden from the world out there. If they want to access it, they can use the publi web user account or register a new account that will automatically sign them up to the right web group.

                      Am I thinking on a different problem/question?
                        Wendy Novianto
                        [font=Verdana]PT DJAMOER Technology Media
                        [font=Verdana]Xituz Media