// без тега формы

const credentials = {
   login: 'admin',
   password: 'qwerty',
}

const confirmBtn = document.querySelector('[data-action=confirm]')
const infoBlock = document.querySelector('.info_block')

confirmBtn.addEventListener("click", () => {
   const loginField = document.querySelector('[data-value=login]')
   const passwordField = document.querySelector('[data-value=password]')

   if (credentials.login === loginField.value && credentials.password === passwordField.value) {
      infoBlock.classList.add('green')
      infoBlock.classList.remove('red')
      infoBlock.textContent = 'success'
   } else {
      infoBlock.classList.add('red')
      infoBlock.classList.remove('green')

      if (credentials.login === loginField.value) {
         infoBlock.textContent = 'incorrect password'
      } else if (credentials.password === passwordField.value) {
         infoBlock.textContent = 'incorrect login'
      } else {
         infoBlock.textContent = 'incorrect login and password'
      }

   }
})