I'm in the process of creating a website that includes a login feature. The usernames and passwords are currently stored within the website files as .txt documents. I am aware that this method is not secure, but for the purpose of this project, I want to test the system's vulnerability. Below is the existing code:
var attempt = 3;
function validate(){
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
if ( username == "username" || username == "Username" && password == "B6YC98"){
window.location = "success.html";
return false;
}
else{
attempt --;
alert("You have "+attempt+" attempt(s) left;");
if( attempt == 0){
document.getElementById("username").disabled = true;
document.getElementById("password").disabled = true;
document.getElementById("submit").disabled = true;
return false;
}
}
}
My question is how do I modify the code to verify if the username entered matches one from usernames.txt? The same goes for the passwords.