Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function login()
- {
- var username = document.getElementById(this.id + "-username").value;
- var password = document.getElementById(this.id + "-password").value;
- var usuariostorage = localStorage.getItem("usuario");
- var http = getHTTPObject();
- //var url = "http://" + username + ":" + password + "@" + this.action.substr(7);
- var url = this.action;
- if (navigator.onLine) {
- http.open("get", url, false, username, password);
- http.send("");
- if (http.status == 200) {
- localStorage.setItem("logado", "1");
- localStorage.setItem("usuario", username);
- document.location = 'dashboard.html';
- } else if (username == usuariostorage) {
- localStorage.setItem("logado", "1");
- document.location = 'dashboard.html';
- } else {
- alert("Usuário ou senha inválidos!");
- }
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement