0

Is there a way to make a store accessible (or maybe specific cms pages) by admin only or with a password? Need to set it up so that clients can do this for future stores while in testing mode -without them having to dive into editing htaccess file. Or can you recommend an extension (besides "Advanced Permissions").

Thanks for any guidance you can give on this.

1 Answer 1

1

You can accomplish this by using javascript.

Please put this script in a javascript file and include that javascript file in pages in which you want to add password protection.

function passWord() {
    var testV = 1;
    var pass1 = prompt('Please Enter Your Password',' ');
    while (testV < 2) {
        if (!pass1) history.go(-1);
        if (pass1.toLowerCase() == "Password") {
            alert('You Got it Right!');
            window.open('window.location.href');
            break;
        } 
        testV+=1;
        var pass1 = prompt('Access Denied - Password Incorrect, Please Try Again.','Password');
    }
    if (pass1.toLowerCase()!="password" & testV ==3) history.go(-1);
    return " ";
}

Edit: Create a module and add a column (yes/no type) in cms_page table using the module.

Show the column in cms page edit form. If it's value is yes for a page, then include the above-mentioned javascript file in the page using layout xml.

Please let me know if it worked for you.

2
  • Thanks for the response, Mohit- I think that would do the trick, but I am really looking for something that I can set it up so that clients can do this on their own for future stores while in testing mode. So they need to be able to change some sort of Magento dashboard setting ...not edit any code.
    – Matt Ellis
    Commented Oct 4, 2017 at 17:21
  • Hi Matt, please see my updated answer. Sorry for the delay. Commented Oct 6, 2017 at 6:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.