<meta charset="UTF-8">
<h1>LOGIN SCREEN</h1>
<script>
function correctLogin(){<!-- Successful login funtion -->
document.write("Hi " + userSaved + ", welcome to the system!");
}
var userSaved = "alura";
var passwordSaved = "alura123";
var tries = 3;
for(var count = 1; count <= tries; count++){<!-- This FOR allows three errors in the access data -->
var userTyped = prompt("User");
var passwordTyped = prompt("Password");
if(userSaved == userTyped && passwordSaved == passwordTyped){<!-- -->
correctLogin();
break;
}
else if (count == tries){
document.write("Third mistake, try tomorrow");
}
else{
alert("Wrong info, try again");
}
}
</script>