コード例 #1
0
        public ActionResult CookieConsentBadge()
        {
            if (!_privacySettings.EnableCookieConsent)
            {
                return(new EmptyResult());
            }

            if (CookieConsent.GetStatus(this.ControllerContext.ParentActionViewContext) != CookieConsentStatus.Asked)
            {
                return(new EmptyResult());
            }

            var model = new CookieConsentModel();

            if (!_privacySettings.CookieConsentBadgetext.HasValue())
            {
                // Loads default value if it's empty (must be done this way as localized values can't be initial values of settings)
                model.BadgeText = T("CookieConsent.BadgeText", Services.StoreContext.CurrentStore.Name, Url.Topic("PrivacyInfo"));
            }
            else
            {
                model.BadgeText = _privacySettings.GetLocalized(x => x.CookieConsentBadgetext).Value.FormatWith(Services.StoreContext.CurrentStore.Name, Url.Topic("PrivacyInfo"));
            }

            return(PartialView(model));
        }
コード例 #2
0
        public ActionResult RevokeConsentCookie()
        {
            CookieConsent.RemoveConsentCookie(Response, this);
            ViewBag.AskCookieConsent = false;
            ViewBag.HasCookieConsent = false;

            return(View("Index"));
        }
コード例 #3
0
        public ActionResult SetCookieConsentBadge(CookieConsentModel model)
        {
            CookieConsent.SetCookie(Response, CookieConsentStatus.Consented);

            if (!HttpContext.Request.IsAjaxRequest() && !ControllerContext.IsChildAction)
            {
                return(RedirectToReferrer());
            }

            return(Json(new { Success = true }));
        }
コード例 #4
0
        public ActionResult SetCookieConsentBadge(CookieConsentModel model)
        {
            CookieConsent.SetCookieConsent(Response, true);

            if (!HttpContext.Request.IsAjaxRequest() && !ControllerContext.IsChildAction)
            {
                return(RedirectToReferrer());
            }

            return(new EmptyResult());
        }
コード例 #5
0
ファイル: SiteController.cs プロジェクト: weedkiller/NINE
        /// <summary>
        ///
        /// </summary>
        /// <param name="ReturnUrl"></param>
        /// <returns></returns>
        public ActionResult NoCookies(string ReturnUrl)
        {
            CookieConsent.SetCookieConsent(Response, false);
            // if we got an ajax submit, just return 200 OK, else redirect back
            if (Request.IsAjaxRequest())
            {
                return(new HttpStatusCodeResult(System.Net.HttpStatusCode.OK));
            }


            return(RedirectToLocal(ReturnUrl));
        }
コード例 #6
0
 public ActionResult AllowCookies(string returnUrl)
 {
     CookieConsent.SetCookieConsent(Response, true);
     if ((returnUrl != null) && Url.IsLocalUrl(returnUrl))
     {
         return(LocalRedirect(returnUrl));
     }
     else
     {
         return(RedirectToAction("Index", "Home"));
     }
 }
コード例 #7
0
 public ActionResult NoCookies(string ReturnUrl)
 {
     CookieConsent.SetCookieConsent(Response, false);
     // if we got an ajax submit, just return 200 OK, else redirect back
     if (Request.IsAjaxRequest())
     {
         return(new HttpStatusCodeResult(System.Net.HttpStatusCode.OK));
     }
     else
     {
         return((ReturnUrl == "/") ? RedirectToAction("Index", "Home") : RedirectToAction(ReturnUrl));;
     }
 }
コード例 #8
0
ファイル: SiteController.cs プロジェクト: EwiPraca/ewipraca
        public ActionResult NoCookies(string ReturnUrl)
        {
            CookieConsent.SetCookieConsent(Response, false);

            if (Request.IsAjaxRequest())
            {
                return(new HttpStatusCodeResult(System.Net.HttpStatusCode.OK));
            }
            else
            {
                return(Redirect(ReturnUrl));
            }
        }
コード例 #9
0
        public IActionResult CookieConsent(CookieConsent consent)
        {
            var additionalCookiesConsent = consent.AdditionalCookies == "accept";
            var cookieSettings           = new CookieSettings
            {
                GoogleAnalyticsGpg   = additionalCookiesConsent,
                GoogleAnalyticsGovUk = additionalCookiesConsent,
                RememberSettings     = additionalCookiesConsent
            };

            CookieHelper.SetCookieSettingsCookie(Response, cookieSettings);
            CookieHelper.SetSeenCookieMessageCookie(Response);

            return(RedirectToAction("Index", "Viewing"));
        }
コード例 #10
0
ファイル: PbkBaseTest.cs プロジェクト: pithas93/PobucaTests
        public void SetUpTest()
        {
            Report.InitializeReportFile();
            Report.Initialize(TestContext.FullyQualifiedTestClassName, TestContext.TestName);
            Driver.Initialize(browser);

            LoginPage.GoTo();

            // In case browser is already logged in, there is no need to login
            if (!ContactsPage.IsAt)
            {
                LoginPage.LoginAs(Username).WithPassword(Password).Login();
            }

            CookieConsent.Close();
            TakeTourWindow.Close();
        }
コード例 #11
0
        public void CookieController_CookieConsent_Redirect_To_HomePage()
        {
            // Arrange
            var controllerBuilder = new ControllerBuilder <CookieController>();
            var controller        = controllerBuilder
                                    .Build();
            var cookieConsent = new CookieConsent {
                AdditionalCookies = "accept"
            };

            // Act
            var result = controller.CookieConsent(cookieConsent) as RedirectToActionResult;

            // Assert
            Assert.NotNull(result);
            Assert.AreEqual(result.ControllerName, "Viewing");
            Assert.AreEqual(result.ActionName, "Index");
        }
コード例 #12
0
        public ActionResult NoCookies(string returnUrl)
        {
            CookieConsent.SetCookieConsent(Response, false);

            if (SiteHelper.IsAjaxRequest(HttpContext.Request))
            {
                return(StatusCode(200));     //// if we got an ajax submit, just return 200 OK
            }
            else
            {
                if ((returnUrl != null) && Url.IsLocalUrl(returnUrl))
                {
                    return(LocalRedirect(returnUrl));
                }
                else
                {
                    return(RedirectToAction("Index", "Home"));
                }
            }
        }
コード例 #13
0
        public void CookieController_CookieConsent_Cookies_Rejected()
        {
            // Arrange
            var controllerBuilder = new ControllerBuilder <CookieController>();
            var controller        = controllerBuilder
                                    .Build();
            var cookieConsent = new CookieConsent {
                AdditionalCookies = "reject"
            };
            var expectedCookieSettings = new CookieSettings
            {
                GoogleAnalyticsGpg = false, GoogleAnalyticsGovUk = false, RememberSettings = false
            };

            // Act
            controller.CookieConsent(cookieConsent);

            // Assert
            controller.AssertCookieAdded("cookie_settings", JsonConvert.SerializeObject(expectedCookieSettings));
            controller.AssertCookieAdded("seen_cookie_message", "{\"Version\":1}");
        }
コード例 #14
0
 public ActionResult AllowCookies(string ReturnUrl)
 {
     CookieConsent.SetCookieConsent(Response, true);
     return((ReturnUrl == "/") ? RedirectToAction("Index", "Home") : RedirectToAction(ReturnUrl));
 }
コード例 #15
0
ファイル: SiteController.cs プロジェクト: EwiPraca/ewipraca
        public ActionResult AllowCookies(string ReturnUrl)
        {
            CookieConsent.SetCookieConsent(Response, true);

            return(Redirect(ReturnUrl));
        }
コード例 #16
0
        public ActionResult CookieConsentBadge(CookieConsentModel model)
        {
            CookieConsent.SetCookieConsent(Response, true);

            return(new EmptyResult());
        }