Streaming live at 10am (PST)

Password protection – work around for collection pages

The client’s asked me to password protect a small section of a site, but that’s to include a staff news blog. So, now I’m stuck since password protection isn’t available for dynamic pages.

I’d like to pick your brains: Is there any work-around at all adding Custom Code to the collection page template?

It seems that WF places a cookie named ‘wf_auth_page’

I was thinking like so:

  1. Javascript to check whether wf_auth_page cookie exists
  2. If yes, do nothing
  3. If no, re-direct to URL (landing page of protected section, which would bing up the password page)

I would use or robots.txt to prevent search engines listing it – and perhaps interactions to prevent content showing up before the cookie check has taken place.

Perhaps all not perfect, but this would seem like a reasonable work-around to me. Trouble is that I can’t do Javascript, so would be hoping for some help here (and maybe this then also helps others).

Thank you!

Very basic password protection:

var password = "letmein";
if(prompt("Enter password:", "") !== password) window.location = "/";

Paste this in Page Settings > Header Code.

Thank you for your reply @samliew. But this isn’t what I was asking about. I need to protect a collection page AS PART OF other static pages that are protected – i.e. no new/different password to be entered, but the collection pages should be visible to those who have are logged on with all others to be re-directed.

In that case, please vote for this wishlist item

There is no workaround as this is implemented server-side.

I would but I haven’t got any votes left.


Password: letmein

1 Like

Thank you for the code.
I only counter one problem. If the time taking too long, the page will jump to home page.