public ActionResult Login(LoginViewModel lvm) { if (ModelState.IsValid) { bool success = WebSecurity.Login(lvm.Username, lvm.Password, false); if (success) { return RedirectToAction("Index"); } else { ModelState.AddModelError("IncorrectLogin", "Incorrect Username/Password Combination!"); } } return View(lvm); }
public ActionResult Login(string d = "0") { LoginViewModel lvm = new LoginViewModel { Username = "", Password = "" }; // user has tried to login to deleted account if (d == "1") { ModelState.AddModelError("DeletedUser", "Invalid login: Account has been deleted."); } return View(lvm); }