Exemplo n.º 1
2
 private LoginEntity LoginModeltoLoginEntity(LoginModel model)
 {
     LoginEntity entity = new LoginEntity();
     entity.Email = model.User;
     entity.Senha = Crypto.MD5(model.Password);
     entity.Novo = model.Novo;
     return entity;
 }
Exemplo n.º 2
0
        public ActionResult Logar(LoginModel login)
        {
            LoginBLL BLL = new LoginBLL();
            if(BLL.VerificaLogin(login))
            {
                ViewBag.Validacao = true;
                Session["USR"] = login;
                if(login.Novo == 0)
                    return RedirectToAction("Index", "Home");
                else
                    return RedirectToAction("EditarPerfil", "EditarPerfil");
            }

            ViewBag.Validacao = false;
            return View("login",login);
        }
Exemplo n.º 3
0
        public bool VerificaLogin(LoginModel model)
        {
            LoginDAO DAO = new LoginDAO();

            if(!string.IsNullOrEmpty(model.User) && !string.IsNullOrEmpty(model.Password))
                if(model.User.Length > 0 && model.User.Length <= 200 && model.Password.Length >= 4 && model.Password.Length < 20)
                {
                    DataTable data = DAO.EfetuaLogin(LoginModeltoLoginEntity(model));

                    if(data.Rows.Count > 0)
                        model.Novo = (int)data.Rows[0].ItemArray[2];
                    return data.Rows.Count > 0;
                }

            return false;
        }