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("line-height", "150%")
document.querySelector("#isso-thread .auth-section").insertBefore(legal, document.querySelector(".auth-section .post-action"))
faux_submit.addEventListener("click", () => {
if (!checkbox.checked) {
checkbox.reportValidity()
} else {
original_submit.click()
}
const email_input = document.querySelector("#isso-thread").querySelector(`input[type="email"]`)
email_input.placeholder = "adres E-mail";
email_input.required = true;
faux_submit.addEventListener("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)
}