Skip to content

Commit

Permalink
pw protection
Browse files Browse the repository at this point in the history
  • Loading branch information
domonik committed Oct 18, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent da47664 commit 2cd185a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion episodes/files/additional.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
console.log("JS loaded")

window.onload = function() {
console.log("Running function")
const dropdownButton = document.getElementById('dropdownMenu1');
const ddparent = document.getElementById('instructor-dropdown');
dropdownButton.disabled = true;
const correctPassword = "D&DPython"; // Set your hardcoded password here
let isPasswordCorrect = false;

console.log("FOOOOO")
console.log(dropdownButton)
@@ -14,4 +16,17 @@ window.onload = function() {
button.style.opacity = '0.5';
});
}
ddparent.addEventListener('click', function(event) {
if (!isPasswordCorrect) { // Only prompt for password if not correct yet
const password = prompt("Please enter the password:");

if (password === correctPassword) {
isPasswordCorrect = true;
dropdownButton.disabled = false;
dropdownButton.click(); // Manually trigger the click after unlocking
} else {
alert("Incorrect password.");
}
}
});
};

0 comments on commit 2cd185a

Please sign in to comment.