All Collections
API / Customization / Advanced
Poor Man's Way to Password Protect a Page or Experience
Poor Man's Way to Password Protect a Page or Experience

Are you looking for a quick and easy way to password protect a page in our system? This snippet will help.

Updated over a week ago

You need to add this code to your layout and change the curPath value to match the page you want to run it on.

Here's the sample codes:

<script type="text/javascript">
var pw = 'ABC123';
if (curPath=='survey_group.aspx' && getCookie('protected') != pw) {
myApp.showPleaseWait();
window.setTimeout(function() {
var val = window.prompt("Please enter the passcode to continue applying.","");
if (val == pw) {
setCookie('protected', val, 30);
myApp.hidePleaseWait();
} else {
alert("Sorry, wrong value.");
window.location.href = window.location;
}
}, 200)
}
</script>

Did this answer your question?