public ActionResult LogIn(LogInModel model) { if (!ModelState.IsValid) { return View(); } //var user = userManager.Find(model.Email, model.Password); var user2 = userManager.FindByEmail(model.Email); var user = userManager.Find(user2.UserName, model.Password); if (user != null) { var identity = userManager.CreateIdentity( user, DefaultAuthenticationTypes.ApplicationCookie); GetAuthenticationManager().SignIn(identity); return Redirect(GetRedirectUrl(model.ReturnUrl)); } // user authentication failed ModelState.AddModelError("", "Invalid email or password"); return View(); }
// // GET: /Auth/Login/ public ActionResult LogIn(string returnUrl) { var model = new LogInModel { ReturnUrl = returnUrl }; return View(model); }