I am working on a functionality that involves comparing user input with predefined usernames and passwords. Here is what I have so far:
var sys = {
users: [
{user: 'user1', pass: 'qwerty'},
{user: 'Ragnar', pass: 'lothbrok'},
{user: 'guest', pass: 'guest'}
],
valid: function(){
var userInp = document.getElementById("userInp").value;
// var pwInp = document.getElementById("pwInp").value;
var check = false;
for (var i=0; i < sys.users.length; i++ ){
if (userInp == sys.users.user /*&& apwInp == 'sys.users{pass}'*/) {
alert ("logged in")
} else {
alert ("no match")
}
}
}
}
I am determined to make it work in this specific way, but I am facing some challenges with it.