public ActionResult Login(LoginData data) { if (ModelState.IsValid) { if (data != null) { string hash = string.Empty; if (data.Check(out hash)) { data.Load(); Session["UserID"] = data.ID; Session["UserName"] = data.Name; Session["UserRole"] = data.role.RoleString; Session.Timeout = 240; controllerUtils.DataLog("User " + data.Name + " loged as " + data.role.RoleString + " with hash = " + hash + ": success"); return(RedirectToAction("PersonList")); } else { controllerUtils.DataLog("User " + data.Name + " loged as " + data.role.RoleString + " with hash = " + hash + ": fail"); } } } return(View("Login", data)); }
public ActionResult Login(LoginData data) { if (ModelState.IsValid) { if ((data != null) && (data.Check())) { Session["UserID"] = data.ID; Session["UserName"] = data.Name; return(RedirectToAction("PersonList")); } } return(View("Login", data)); }