Exemplo n.º 1
0
        public ActionResult Logout(string lang)
        {
            _accountService.Logout();

            TempData["Message"] = "Logout.Submit.Success";

            return(Redirect(AccountRedirectUrls.Home(lang)));
        }
Exemplo n.º 2
0
        public ActionResult ActivateAccount(string lang, string token)
        {
            var loginPageUrl = AccountRedirectUrls.LoginPage(lang);
            var result       = _accountService.ActivateAccount(token);

            if (result)
            {
                CookiesExtensions.CreateCookie(CookieVariables.TempMessageCookie, "ActivateAccount.Submit.Success");
            }

            return(Redirect(loginPageUrl));
        }
Exemplo n.º 3
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (filterContext.IsChildAction)
            {
                return;
            }

            var action   = filterContext.ActionDescriptor;
            var context  = filterContext.HttpContext;
            var language = GetLanguage(context.Request);

            var loginUrl = AccountRedirectUrls.LoginPage(language);
            var homeUrl  = AccountRedirectUrls.Home(language);

            if (HasAttribute <AuthorizedOnlyAttribute>(action) && !IsAuthenticated(context))
            {
                filterContext.Result = new RedirectResult(loginUrl);
            }

            if (HasAttribute <GuestsOnlyAttribute>(action) && IsAuthenticated(context))
            {
                filterContext.Result = new RedirectResult(homeUrl);
            }
        }