protected override void OnActionExecuting(ActionExecutingContext filterContext) { string controllerName = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName; if (CookieHelper.CookieExist("Administrator_Username") == false) { filterContext.Result = new RedirectResult(Url.Action(MVC.Account.Login())); } }
public virtual ActionResult Logout() { CMSUser _User = null; if (CookieHelper.CookieExist("Administrator_Username") == true) { string userLoggedInString = CookieHelper.Get("Administrator_Username", true); _User = CMSUser.GetByUsername(userLoggedInString); } CookieHelper.Remove("Administrator_Username"); CookieHelper.RemoveAll(); return(RedirectToAction(MVC.Account.Login())); }
public virtual ActionResult Login() { ViewBag.Title = "Login"; if (CookieHelper.CookieExist("Administrator_Username") == true) { string userLoggedInString = CookieHelper.Get("Administrator_Username", true); CMSUser userLoggedIn = CMSUser.GetByUsername(userLoggedInString); if (userLoggedIn == null) { return(RedirectToAction(MVC.Account.Logout())); } return(Redirect(Url.Content("~"))); } else { return(View()); } }