We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18477
    • 2 Posts
    Hi,
    I am building a website for my upcoming marriage this year and am using modx - which I love.
    The site will have a load of details on it that I don’t want the general public to get access to, but needs to be accessible to all my guests (locations, dates, start times stuff like that).
    My intention is to send out postal and email invites and ask people to go to the website to RSVP. My idea is to include a generic password in the invite to all the guests (like ’MartinsGettingMarried’) so that they can use it to login to the site.

    What I am imagining is a homepage that has a single text field on it that says ’Enter your password here’. If they enter the right one, it takes them to the site, if not they get an access denied message.

    I was going to set up a web user for this but I don’t want them to have to enter a username, just a password. Is there a sensible way to do that?

    Thanks,
    Martin
      • 18477
      • 2 Posts
      Ok I have this sussed now.
      I edited weblogin.processor.inc.php and added an if statement under line 188 that gets the posted username.

      $username = $modx->db->escape(htmlspecialchars($_POST[’username’], ENT_QUOTES));

      The If statement looks like this:

      //if username is empty user is ’guest’
      if($username==""){
      $username="guest";
      }

      Which achieves what I am looking for as I have created a web user called guest so my guests will be able to come to the login page (that will only display the password field and login.
        • 4749
        • 623 Posts
        Try DocPassword it works great!
          The MODx has you...
          Utah Web Design
          • 3749
          • 24,544 Posts
          There are various ways of doing this (including DocPassword). I think you’ll be happier in the long run if you do it without hacking the core. wink

          One of the beauties of MODx is that hacking the core is almost *never* necessary.

            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
            • 6531
            • 154 Posts
            Any way to do this on Revo?
            DocPassword seems to do nothing at all.
              • 34004
              • 125 Posts
              I am also interested in very simple password protection without user accounts for Revo - any solutions out there?
                • 3749
                • 24,544 Posts
                It's fairly easy to write a snippet that just forwards the user to the Login page if they are not logged in, then put a tag for that snippet in your template:

                [[!Protect]]


                <?php
                
                /* Protect snippet */
                
                if (! modx->user->hasSessionContext($modx->context->get('key'))) {
                     $loginId = 12;  // replace this with the ID of your login page
                     $modx->sendRedirect($modx->makeUrl($loginId, "", "", "full"));
                }
                

                On the login page, put this:

                [[!Login? &redirectToPrior=`1`]]


                That will redirect the user back to the page they tried to access after they log in.


                ---------------------------------------------------------------------------------------------------------------
                PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
                MODx info for everyone: http://bobsguides.com/modx.html
                  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
                  • 36709
                  • 4 Posts
                  Hello,

                  if anyone is still intersted in extension which with you can lock individual website, check this:
                  http://shop.spletnisistemi.si/en/modx-lock-website-with-password.html

                  Locking is simple, for login to protected page you just need to insert password (without username). [ed. note: spletnisistemi last edited this post 14 years, 7 months ago.]