better way to hide protected page

This commit is contained in:
Ville Rantanen
2021-05-10 15:41:26 +03:00
parent 8d0b3145ea
commit eecbd58d19

View File

@@ -360,7 +360,10 @@ function pw(element) {
if (element.value) { if (element.value) {
pw = pw.split(':',2); pw = pw.split(':',2);
if (element.value.hashCode() == parseInt(pw[0])) { if (element.value.hashCode() == parseInt(pw[0])) {
this.location.href = "TARGET_BASE." + unscramble(element.value, atob(pw[1])) + "TARGET_EXT"; document.getElementById("body").innerHTML = '';
var frame = document.createElement("iframe");
frame.src = "TARGET_BASE." + unscramble(element.value, atob(pw[1])) + "TARGET_EXT";
document.getElementById("body").appendChild(frame);
} else { } else {
document.getElementById("message").innerHTML = "No match"; document.getElementById("message").innerHTML = "No match";
setTimeout(clear_message, 5000); setTimeout(clear_message, 5000);
@@ -379,6 +382,15 @@ function newPass(password, target) {
//console.log("Use newPass('pass','page.html'); to get a new hash"); //console.log("Use newPass('pass','page.html'); to get a new hash");
</script> </script>
<style> <style>
iframe {
width: 100vw;
height: 100vh;
}
#body {
margin: 0;
overflow-x: hidden;
overflow-y: hidden;
}
#content { #content {
text-align: center; text-align: center;
padding-top: 4rem; padding-top: 4rem;
@@ -393,7 +405,7 @@ function newPass(password, target) {
} }
</style> </style>
</head> </head>
<body> <body id="body">
<div id="content"> <div id="content">
<input type="password" placeholder="Password" class="password" onkeydown="pw_event(this)" id="password" onFocus="this.select()" autofocus/> <input type="password" placeholder="Password" class="password" onkeydown="pw_event(this)" id="password" onFocus="this.select()" autofocus/>
<br><button id="button" type="button" onclick="pw(document.getElementById('password'));">Enter</button> <br><button id="button" type="button" onclick="pw(document.getElementById('password'));">Enter</button>