Skip to main content
All CollectionsStoreSite pages
How to set up simple password protection
How to set up simple password protection

Set up basic password protection for your site home page.

Ed Boaden avatar
Written by Ed Boaden
Updated over a week ago

To force users to enter a password to access your site home page, follow the steps below. This won't truly stop users from accessing the site pages if they know the right URL to go to, so don't use for sensitive content.

How to set up

  1. Add your landing page content to a new page (not Home).

  2. On your home page, add a Code module and enter the code below.

<script>

passWord();

function passWord() {
var testV = 1;
var pass1 = prompt('Please enter a password','');
while (testV < 3) {
if (!pass1) history.go(-1);
if (pass1.toLowerCase() == "password1234") {
window.location = '/home';
break;
}
testV+=1;
var pass1 =
prompt('Password incorrect','Password');
}

if (pass1.toLowerCase()!="password" & testV ==3)
history.go(-1);
return " ";
}

</script>

3. Replace the example password with the one you want to share with your customer base.

4. Replace the page URI /home with the URI for the page where your home page content will sit.

5. Change the logo link URI to go back to the temp home page and not the password screen by adding the following code to the custom JS on the Design Settings.

$('.logo-link').attr('href', '/home');

To remove the password protection

  1. Change the landing page name / slug to something else (e.g. password) and inactivate the page.

  2. Change your home page slug to index - this will restore it as your home page

  3. Set up a redirect to from the temp home to the new one (contact Ochre support to do this).

  4. Remove the custom JS from the Design Settings

Did this answer your question?