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)); }
public ActionResult RevokeConsentCookie() { CookieConsent.RemoveConsentCookie(Response, this); ViewBag.AskCookieConsent = false; ViewBag.HasCookieConsent = false; return(View("Index")); }
public ActionResult SetCookieConsentBadge(CookieConsentModel model) { CookieConsent.SetCookie(Response, CookieConsentStatus.Consented); if (!HttpContext.Request.IsAjaxRequest() && !ControllerContext.IsChildAction) { return(RedirectToReferrer()); } return(Json(new { Success = true })); }
public ActionResult SetCookieConsentBadge(CookieConsentModel model) { CookieConsent.SetCookieConsent(Response, true); if (!HttpContext.Request.IsAjaxRequest() && !ControllerContext.IsChildAction) { return(RedirectToReferrer()); } return(new EmptyResult()); }
/// <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)); }
public ActionResult AllowCookies(string returnUrl) { CookieConsent.SetCookieConsent(Response, true); if ((returnUrl != null) && Url.IsLocalUrl(returnUrl)) { return(LocalRedirect(returnUrl)); } else { return(RedirectToAction("Index", "Home")); } }
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));; } }
public ActionResult NoCookies(string ReturnUrl) { CookieConsent.SetCookieConsent(Response, false); if (Request.IsAjaxRequest()) { return(new HttpStatusCodeResult(System.Net.HttpStatusCode.OK)); } else { return(Redirect(ReturnUrl)); } }
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")); }
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(); }
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"); }
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")); } } }
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}"); }
public ActionResult AllowCookies(string ReturnUrl) { CookieConsent.SetCookieConsent(Response, true); return((ReturnUrl == "/") ? RedirectToAction("Index", "Home") : RedirectToAction(ReturnUrl)); }
public ActionResult AllowCookies(string ReturnUrl) { CookieConsent.SetCookieConsent(Response, true); return(Redirect(ReturnUrl)); }
public ActionResult CookieConsentBadge(CookieConsentModel model) { CookieConsent.SetCookieConsent(Response, true); return(new EmptyResult()); }