Spaces:
Sleeping
Sleeping
File size: 2,331 Bytes
bce4323 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" >
<!-- content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' /> -->
<title>Login</title>
<!-- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> -->
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<div id="login-container">
<h1>Login</h1><br>
<p>Olá! Insira usuário e senha para continuarmos.</p>
<form action="javascript:autentica()" id="form_id" method="get">
<label for="email">Usuário</label>
<input type="email" name="email" id="email" placeholder="Digite seu usuário" oninvalid="this.setCustomValidity('Por favor entre com um email válido')" autocomplete="off" >
<label for="password">Senha</label>
<input type="password" name="password" id="password" placeholder="Digite sua senha">
<input type="submit" value="Login" >
</form>
<a href="#" id="forgot-pass">Esqueceu a senha?</a>
</div>
<script>
function autentica() {
var xhttp = new XMLHttpRequest();
var usuario = document.getElementById("email").value;
var senha = document.getElementById("password").value;
xhttp.onreadystatechange = function () {
if (this.readyState == 4) {
if(this.status == 200) {
var json = JSON.parse(this.responseText);
storeLogin(json.nome);
// alert("ACESSO OK : " );
redirect(json.url);
console.log("redirecionado para "+json.url);
}
else
{
alert("ACESSO NEGADO : " + this.responseText);
}
}
};
xhttp.open("GET", "/autentica?email="+usuario+"&passw="+senha, true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.send("");
}
function redirect(url)
{
window.parent.location.href=url;
window.parent.location.assign(url);
window.parent.location.replace(url);
}
function storeLogin(name)
{
setCookieh("LOGIN",name);
}
function setCookieh(name,value) {
window.localStorage.setItem(name, value);
}
</script>
</body>
</html> |