public ActionResult LogOn(LogOnModel model, string returnUrl) { if (!ModelState.IsValid) { if (model == null) model = new LogOnModel(); return View(model); } if (!MembershipService.ValidateUser(model.Email, model.Password)) { ModelState.AddModelError("_FORM", ValidationResources.UserNameOrPasswordIncorrect); return View(model); } FormsAuthService.SignIn(model.Email, model.RememberMe); if (!String.IsNullOrEmpty(returnUrl)) return Redirect(returnUrl); return RedirectToAction("Index", "Home"); }
public ActionResult LogOn(LogOnModel model) { if (!ModelState.IsValid) { if (model == null) model = new LogOnModel(); if (HttpContext.Request.IsAjaxRequest()) { return Json(new AjaxLogOnModel { Success = false, Html = this.RenderViewToString("LogOnFormControl", model) }); } return View(model); } if (!_membershipService.ValidateUser(model.Email, model.Password)) { ModelState.AddModelError("_FORM", ValidationResources.UserNameOrPasswordIncorrect); if (HttpContext.Request.IsAjaxRequest()) { return Json(new AjaxLogOnModel { Success = false, Html = this.RenderViewToString("~/Views/Account/Controls/LogOnFormControl.ascx", model) }); } return View(model); } _formsAuthService.SignIn(model.Email, model.RememberMe); if (HttpContext.Request.IsAjaxRequest()) return Json(new AjaxLogOnModel { Success = true, }); if (Url.IsLocalUrl(model.ReturnUrl)) return Redirect(model.ReturnUrl); return RedirectToAction("Index", "Home"); }
public ActionResult LogOn(string returnUrl) { if (User.Identity.IsAuthenticated) return RedirectToAction("Index", "Home"); LogOnModel model = new LogOnModel(); model.ReturnUrl = returnUrl; return View(model); }
public ActionResult LogOn() { LogOnModel model = new LogOnModel(); return View(model); }