Make email field mandatory

This commit is contained in:
Kuba Orlik 2023-02-09 13:05:02 +01:00
parent b3d46f238e
commit f22d3f7cd5

View File

@ -235,12 +235,17 @@
legal.style.setProperty("font-size", "1.333rem") legal.style.setProperty("font-size", "1.333rem")
legal.style.setProperty("line-height", "150%") legal.style.setProperty("line-height", "150%")
document.querySelector("#isso-thread .auth-section").insertBefore(legal, document.querySelector(".auth-section .post-action")) document.querySelector("#isso-thread .auth-section").insertBefore(legal, document.querySelector(".auth-section .post-action"))
faux_submit.addEventListener("click", () => { const email_input = document.querySelector("#isso-thread").querySelector(`input[type="email"]`)
if (!checkbox.checked) { email_input.placeholder = "adres E-mail";
checkbox.reportValidity() email_input.required = true;
} else { faux_submit.addEventListener("click", ()=>{
original_submit.click() if(!email_input.validity.valid){
} email_input.reportValidity()
}else if(!checkbox.checked){
checkbox.reportValidity()
}else {
original_submit.click()
}
}) })
original_submit.parentElement.appendChild(faux_submit) original_submit.parentElement.appendChild(faux_submit)
} }