public IHttpActionResult Post([FromBody] Usuario datosLogin) { try { Usuario u = RepositorioLogin.ObtenerUsuarioPorUsername(datosLogin.NombreUsuario); if (u.Autorizado) { return(Ok(u)); } else { if (RepositorioLogin.AutentificarUsuario(datosLogin.NombreUsuario, datosLogin.Contrasenia, datosLogin.Token)) { return(Ok(u)); } else { return(NotFound()); } } } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult CreateNewUsers(Pessoas pessoas, Login logins) { int identificador = new RepositorioPessoas().CadastrarPessoas(pessoas); Login novoLogin = new Login() { IdPessoas = identificador, Email = logins.Email, Senha = Encrypt.SHA512(logins.Senha), Usuario = logins.Usuario }; int deucerto = new RepositorioLogin().CadastrarLogin(novoLogin); return(Content(JsonConvert.SerializeObject(novoLogin))); }
public ActionResult Validamot(Motorista m) { var repLogin = new RepositorioLogin(); var LOGIN = repLogin.ValidarMotorista(m); if (LOGIN.Count >= 1) { return(RedirectToAction("Index", "Motorista")); } else { return(RedirectToAction("PassageiroLogin", "Login")); } }
public ActionResult ValidaPass(Passageiro p) { var repLogin = new RepositorioLogin(); var LOGIN = repLogin.ValidarPassageiro(p); if (LOGIN.Count >= 1) { return(RedirectToAction("Index", "Passageiro", new { LOGIN[0].id })); } else { return(RedirectToAction("PassageiroLogin", "Login")); } }
public ActionResult ValidaGerente(Gerente g) { var repLogin = new RepositorioLogin(); var LOGIN = repLogin.ValidarGerente(g); if (LOGIN.Count >= 1) { return(RedirectToAction("Index", "Home")); } else { return(RedirectToAction("GerenteLogin", "Login")); } }
protected void Unnamed_Click(object sender, EventArgs e) { Usuarios user = new Usuarios(); RepositorioLogin repositorio = new RepositorioLogin(); if (UsuarioTextBox.Text.Length > 0 && PasswordTextBox.Text.Length > 0) { if (repositorio.Auntenticar(UsuarioTextBox.Text, PasswordTextBox.Text)) { FormsAuthentication.RedirectFromLoginPage(user.NombreUser, true); } else { Utils.ShowToastr(this.Page, "Usuario o contraseƱa Incorrecta", "Error", "error"); } } else { Utils.ShowToastr(this.Page, "Introduzca Usuario & ContraseƱa", "Error", "error"); } }
public ActionResult GetLoginJson(string usuario, string senha) { try { var senhaCryp = Encrypt.SHA512(senha); List <Login> login = new RepositorioLogin().ObterTodosLogin(); foreach (Login logins in login) { if (logins.Usuario == usuario && logins.Senha == senhaCryp) { Session["user"] = logins.IdPessoas; return(Content(JsonConvert.SerializeObject(new { user = usuario, pass = senha, data = logins }))); } } } catch (Exception) { return(Content(JsonConvert.SerializeObject(new { data = false }))); } return(Content(JsonConvert.SerializeObject(new { data = false }))); }
public int AgregarInquietud(Login_Inquietud inquietudNuevo) { RepositorioLogin <Login_Inquietud> contexto = new RepositorioLogin <Login_Inquietud>(); return(contexto.InsertarObjeto(inquietudNuevo)); }