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

const login = document.getElementById("login");
const password = document.getElementById("password");
const button = document.querySelector("button");
const wrapper = document.querySelector(".wrapper");
const result = document.querySelector(".result");

button.addEventListener("click", check);
login.addEventListener("keydown", handler);
password.addEventListener("keydown", handler);

function check() {
    result.innerText = "";
    result.classList = [];
    if( credentials.login === login.value && credentials.password === password.value ){
        result.classList.add("done");
        result.innerText = "Done!";
    } else {     
        result.classList.add("fail");  
        result.innerText = "*не верный логин или пароль";
        
    }
}

function handler(e) {
    if( e.keyCode === 13 ){
    check()
    }
}
