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
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.
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.
One of the beauties of MODx is that hacking the core is almost *never* necessary.
Any way to do this on Revo?
DocPassword seems to do nothing at all.
I am also interested in very simple password protection without user accounts for Revo - any solutions out there?
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:
<?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