const buttonLogin=document.getElementById("buttonLogin"),formLogin=document.getElementById("formLogin"),userName=document.getElementById("userName"),password=document.getElementById("password"),messageError1=document.getElementById("messageError1"),messageError2=document.getElementById("messageError2"),div1=document.getElementById("div1"),div2=document.getElementById("div2");let validationLogin=!1;formLogin.addEventListener("submit",function(s){!0===div1.classList.contains("success")&&!0===div2.classList.contains("success")&&(validationLogin=!0),!1===validationLogin&&s.preventDefault()}),buttonLogin.addEventListener("click",function(){let s=userName.value.trim();0===s.length?(div1.classList.remove("success"),messageError1.classList.add("show-error-message")):s.length<5?(div1.classList.remove("success"),messageError1.classList.add("show-error-message")):s.length>=5&&(div1.classList.add("success"),messageError1.classList.remove("show-error-message"));let e=password.value.trim();0===e.length?(div2.classList.remove("success"),messageError2.classList.add("show-error-message")):e.length<8?(div2.classList.remove("success"),messageError2.classList.add("show-error-message")):e.length>=8&&(div2.classList.add("success"),messageError2.classList.remove("show-error-message"))}),userName.addEventListener("input",function(){let s=userName.value.trim();0===s.length?(div1.classList.remove("success"),messageError1.classList.add("show-error-message")):s.length<5?(div1.classList.remove("success"),messageError1.classList.add("show-error-message")):s.length>=5&&(div1.classList.add("success"),messageError1.classList.remove("show-error-message"))}),password.addEventListener("input",function(){let s=password.value.trim();0===s.length?(div2.classList.remove("success"),messageError2.classList.add("show-error-message")):s.length<8?(div2.classList.remove("success"),messageError2.classList.add("show-error-message")):s.length>=8&&(div2.classList.add("success"),messageError2.classList.remove("show-error-message"))});