Password protect entire site - not just each page

Hi all

I need to password protect a website completely, not just each sub-page as per the password protection option on each page’s settings.
E.g.:
User lands on homepage, enters password, this then opens up access to the subpages.

I can do this currently by password protecting the homepage and by making the sub-pages noindex, however it technically still leaves the sub-pages ‘unsecure’ unless I also password protect them separately. Terrible user experience having to enter a password for every page though.

Any ideas? I assume this is something I have to custom code? It seems a shame we have a password function for individual pages but not for the site as a whole :confused:

3 Likes

I’m interested in this also.
More specifically I’m interested in how to set up password-protected subsites for clients of professional services firms, where the client can customize content on one or more pages for client projects with a one page per client acting as a dashboard.

3 Likes

I’m actually confused as to why Sitejet allowed the homepage to be password protected, but this protection didn’t cascade down to the sub pages. Hopefully this is something they can implement? How do we raise their attention to this?

1 Like

Hi! You can protect subpages in SiteJet as long as you’ve set a password to the parent page.
However the downside is that indeed you need to enter the password the first time you access the page/subpage.

Here is a video (with sound) on how to do it:

Hope this helps.

P.S. The audio is quite bad, I hope you can understand it

2 Likes

Hi Lucian
Yes I’m aware of that, hence my post on here :slight_smile:

I’ve protected my client’s homepage but the sub-pages remain technically unprotected as I cannot have a user experience where they enter a password on each and every page - it’s just ridiculous. Hopefully they sort out this functionality so that it works at the top level and cascades down to sub-pages as well…

2 Likes

Hi! I’ve made a custom JS function that is automatically logging the user (if he had previously entered the password on one single page) on all subpages (basically I’m storing the password on the user browser(computer) in the Local Storage).
The only requirement is to use only one password on the website.
Here is the code:

//When document is loaded
$( document ).ready(function() {
    //Register the autologin on page load
    autoLogin();
});


function autoLogin(){
    const storage = localStorage;
    var localStoragePassKey;
    var loginForm = $("body:not(.edit) .ed-protection form");

    if (loginForm){
        var loginPassField = $("body:not(.edit) .ed-protection form input[type='password']");
       // loginPassField.val = 
        //loginForm.submit();
        
        
        if (!storage.getItem("autoLoginPass")) {
            //Storing the Password to the local store
           loginForm.submit(function( event ) {
                storage.setItem("autoLoginPass", loginPassField.val());
            });
        } else {
            $("body:not(.edit) .ed-protection").hide(); //Optional hiding the login form
            loginPassField.val(storage.getItem("autoLoginPass"));
            loginForm.submit();
        }
        
    }
    
}

Just add this to your Asset manager → Javascript

Hope it helps.

3 Likes

Hey guys,

I’m moving this to our feature request category.

Thanks for sharing your input on this and @Lucian_Dinu thanks for sharing this code snippet :pray:

5 Likes

Hi Lucian - thank you (again!) for your input. So, do I enable the same password on each page with this code? Or does the code stop anyone accessing the unprotected pages directly by putting up the password page before they can access?

Hi Paul! My script is just a temporary “fix” for this problem. In the future I think SJ will allow global protection.
The script will only save the password in the user browser (in the Local Storage) and will automatically fill the password in the login form.

Here is a video (with audio) explaining how it works

2 Likes