PF24

PF24 PRE-ACCESS

Wrong Password

const passwordOverlay = document.querySelector('.password-overlay'); const passwordInput = document.querySelector('#password-input'); const passwordButton = document.querySelector('.password-submit'); const passwordFail = document.querySelector('.password-fail'); const password = 'cherish'; function handleSubmitPassword() { if(password === passwordInput.value) { passwordFail.classList.remove('show'); document.body.classList.remove('lock'); passwordOverlay.classList.remove('show'); localStorage.setItem('_hidePasswordOverlay', 'true'); } else { passwordFail.classList.add('show'); } } if(!localStorage.getItem('_hidePasswordOverlay')) { passwordOverlay.classList.add('show'); document.body.classList.add('lock'); passwordButton.addEventListener('click', handleSubmitPassword); passwordInput.addEventListener('keypress', () => { if (event.key === "Enter") { handleSubmitPassword(); } }); }