public ActionResult Login(AccountLoginViewModel model) { if (!ModelState.IsValid) return View(model); // fetch the requested account using the given email and password var account = m_session.Accounts.GetByEmailAndPassword(model.Email, model.Password); if (account == null) { ModelState.AddModelError("Email", "Login failed"); return View(model); } // set auth cookie FormsAuthentication.SetAuthCookie(account.Email, true); return RedirectToAction("Index", "Character"); }
public ActionResult Login() { var model = new AccountLoginViewModel(); return View(model); }