public LogOnModel SecondLogOnModel() { var secondLogOnModel = new LogOnModel { UserName = null, Password = null, RememberMe = new Boolean() , Role = null }; return secondLogOnModel; }
public LogOnModel ThirdLogOnModel() { var thirdLogOnModel = new LogOnModel { UserName = null, Password = null, RememberMe = new Boolean() , Role = null }; return thirdLogOnModel; }
public LogOnModel FirstLogOnModel() { var firstLogOnModel = new LogOnModel { UserName = null, Password = null, RememberMe = new Boolean() , Role = null }; return firstLogOnModel; }
public ActionResult LogOn(LogOnModel model, string returnUrl) { if (!ModelState.IsValid) return View(model); if (MembershipService.ValidateUser(model.UserName, model.Password)) { FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe); if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\")) { return Redirect(returnUrl); } if (Roles.IsUserInRole(model.UserName, "Tenant")) { return RedirectToAction("Index", "Tenant"); } if (Roles.IsUserInRole(model.UserName, "Owner")) { return RedirectToAction("Index", "Owner"); } if (Roles.IsUserInRole(model.UserName, "Agent")) { return RedirectToAction("Index", "Agent"); } if (Roles.IsUserInRole(model.UserName, "Specialist")) { return RedirectToAction("Index", "Specialist"); } if (Roles.IsUserInRole(model.UserName, "Provider")) { return RedirectToAction("Index", "Provider"); } } else { ModelState.AddModelError("", @"The user name or password provided is incorrect."); } return View(model); }