painel / static /novo-front /index.html
Mauricio A. Guerta
Remove save senha
951381e
raw
history blame
2.77 kB
<!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">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
</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" autocomplete="new-password">
<label for="email">Usuário</label>
<input type="email" name="email" id="email"
placeholder="Digite seu usuário"
readonly onclick= "this.removeAttribute('readonly');"
oninvalid="this.setCustomValidity('Por favor entre com um email válido')"
autocomplete="off"
/>
<label for="password">Senha</label>
<input type="text" name="password" id="password"
class="js-text-to-password-onedit"
placeholder="Digite sua senha"
readonly onclick= "this.removeAttribute('readonly');"
autocomplete="off"
style="-webkit-text-security: square;"
/>
<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,json.foto);
// 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,foto)
{
setCookieh("LOGIN", name);
setCookieh("FOTO", foto);
}
function setCookieh(name,value) {
window.localStorage.setItem(name, value);
}
</script>
</body>
</html>