public ActionResult Index(LoginViewModel login) { if (!ModelState.IsValid) return View(); if (!userRepo.ValidateUser(login)) { ModelState.AddModelError("", "Incorrect username or password"); return View(); } var authTicket = new FormsAuthenticationTicket( 1, login.UserName, DateTime.Now, DateTime.Now.AddMinutes(20), // expiry login.RememberMe, "", //roles "/" ); //encrypt the ticket and add it to a cookie HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(authTicket)); Response.Cookies.Add(cookie); return Redirect("UserHome"); }
public bool ValidateUser(LoginViewModel login) { return true; }
public bool ValidateUser(LoginViewModel login) { //return UserAgent.ValidateUser(login); return true; }