cancel
Showing results for 
Search instead for 
Did you mean: 

Password Protect CMS Page

Password Protect CMS Page

Hi,

 

I want to password protect a CMS page - simple password login form is all that is needed.

 

Not a customer login, just simple password protected login form to access content.

 

I recall using a snippet that allowed me to update layout XML to decalre the password, but can't find it anymore.

 

Can anyone recommend a password protection extension or snippet to pull this off?

 

Thanks.

8 REPLIES 8

Re: Password Protect CMS Page

Re: Password Protect CMS Page

It seems that you're looking something like user enter password before go into CMS pages and that pasword should be set by admin (means you) from backend..  Is it something you're talking about ?

-
Magento Programmer | Was my answer helpful? You can accept it as a solution.

Re: Password Protect CMS Page

Was this ever figured out?  I have a client asking for a similar setup.  They want to be able to have a flash sale area where only people who are email a specific password can access the shop, cart and checkout pages.  The password will change weekly and they want to be able to do this.

 

Currently I am thinking it will be a form asking for a password which I will setup in Custom Variables.  If correct a cookie is stored with a short life, otherwise an error message is shown.

 

If there is a better method, I would love to hear it.

Re: Password Protect CMS Page

Has anyone answered this? I have the same question.

Re: Password Protect CMS Page

Simple solution I found but I am not 100% convinced its secure but seems to block the CMS page unless you have entered the right password.  Add this to the top of your CMS page content:

 

<script type="text/javascript">
    var password = 'password123'
    var retVal = prompt("Enter your password : ", "your password here");
    if(retVal !== password)
    {
        location.assign('');
    }
</script>

<!--START OF CONTENT-->

 

  • var password: would be the password you want for the CMS page.
  • location.assign(''); - seems to work better without the ('#').

Hope this helps!

 

Re: Password Protect CMS Page

Is there any way or any additional code that would allow the entered password to "hold" for their session? Every time a user navigates away from that cms page, it makes them re-enter the password which I could see as being frustrating to the customer. Thanks in advance!

Re: Password Protect CMS Page

Is there any way or any additional code that would allow the entered password to "hold" for their session? Every time a user navigates away from that cms page, it makes them re-enter the password which I could see as being frustrating to the customer. Thanks in advance!

Re: Password Protect CMS Page

Seems to work but the only thing I see is when you go to put text under the <!--start of content-->

it's all pushed to the far left side of the page.  Guessing maybe a div or something will have to be added for this but I could be wrong.  Going to keep playing to see what I can come up with.  Any ways thanks for this little gem.  No one seems to have an extension for M2 that will do this yet.