Forum
Perch Password Protected Page
Hello , I'm trying to add the Perch Password Protected Page from https://www.sly-design.co.uk/perch-cms/ and can't make it work. Simon would really appreciate your help here.
I copied the php file in my runway installation, created the text region in admin and set a basic test password. My problem is that when I enter the password to the input it will always give error Password incorrect. Please try again
.
In the bottom of the file I can see the following
// If password is wrong or not entered:
if (isset($_POST['password']) || $password == "") {
print "<p class=\"error\">Password incorrect. Please try again.</p>";}
}
isn't the first condition always be true after a user sets any password or I am missing something?
Thanks in advance for your help!
Proko,
In your above code here is what your asking... If
$password
is set OR$password
equals nothing print this error.The output would always happen so long as a $password is set regardless if it's right or wrong.
What you likely wanted to do is:
but this will still be wrong because you are not actually testing the password to be correct... your just testing if it exists and is not empty.
Proko,
I think you would be better off using Perch Members to restrict access. You could make the page viewable by a member with certain tags, then assign the tag to members who have access to that page.... or even just a region.
Hi Robert! Thanks for taking the time. The issue I think I will have with members app is that it will not allow multiple simultaneous connections.
The use case is the following: Client sends a promo email and end user that already knows the common password clicks a link and lands to the password protected page where uses the password to "unlock" the content. The idea is that there will be many users accessing this page at the same time. Am I right that members app will not cover this case?
Members app can accept unlimited simultaneous users at a time (well server may limit, but this would likely be thousands).
Members app is designed exactly for this... authenticated user access. Perch admin I think is limited to a single "admin" or "editor" but that would likely be to prevent (2) people from editing same content at same time.
Members
The Perch Members app provides the ability for users to register and log into an account on your website. This may be to gain access to secured content, or perhaps to maintain a profile. The app helps you manage members and gives you the tools to build member-based functionality into your site.
Parts of a page can be restricted by tag: EXAMPLE
Thanks Robert. Had a chat with the business and we decided to ask users to create a proper account in order to see the content so I will use the Members app. Thanks again for your suggestions!
You won’t be sorry. It’s a really powerful app and it’s really easy to use.
Your welcome. :)
Completely agree with Robert :)