public async Task <IActionResult> CookieManager() { if (!_privacySettings.EnableCookieConsent) { return(new EmptyResult()); } // If current country doesn't need cookie consent, don't display cookie manager. if (!await DisplayForCountryAsync()) { return(new EmptyResult()); } var cookieData = _cookieConsentManager.GetCookieData(); if (cookieData != null && !HttpContext.Request.IsAjaxRequest()) { return(new EmptyResult()); } var model = new CookieManagerModel(); await PrepareCookieManagerModelAsync(model); return(PartialView(model)); }
public ActionResult CookieManager() { if (!_privacySettings.EnableCookieConsent) { return(new EmptyResult()); } // If current country doesnt need cookie consent, don't display cookie manager. if (!DisplayForCountry()) { return(new EmptyResult()); } var cookieData = _cookieManager.GetCookieData(this.ControllerContext); if (cookieData != null && !HttpContext.Request.IsAjaxRequest()) { return(new EmptyResult()); } var model = new CookieManagerModel(); PrepareCookieManagerModel(model); return(PartialView(model)); }
public async Task <IActionResult> CookieManager() { if (!_privacySettings.EnableCookieConsent) { return(new EmptyResult()); } // If current country doesn't need cookie consent, don't display cookie manager. if (!await DisplayForCountryAsync()) { return(new EmptyResult()); } var cookieData = _cookieConsentManager.GetCookieData(); if (cookieData != null && !HttpContext.Request.IsAjaxRequest()) { return(new EmptyResult()); } var model = new CookieManagerModel(); await PrepareCookieManagerModelAsync(model); // TODO: (mh) (core) Why is this a partial? Are you sure? Please analyze CookieConsentFilter in classic. return(PartialView(model)); }
private void PrepareCookieManagerModel(CookieManagerModel model) { // Get cookie infos from plugins. model.CookiesInfos = _cookieManager.GetAllCookieInfos(); var cookie = _cookieManager.GetCookieData(this.ControllerContext); model.AnalyticsConsent = cookie != null ? cookie.AllowAnalytics : false; model.ThirdPartyConsent = cookie != null ? cookie.AllowThirdParty : false; }
private async Task PrepareCookieManagerModelAsync(CookieManagerModel model) { // Get cookie infos from plugins. model.CookiesInfos = (await _cookieConsentManager.GetAllCookieInfosAsync(true)).ToList(); var cookie = _cookieConsentManager.GetCookieData(); model.AnalyticsConsent = cookie != null && cookie.AllowAnalytics; model.ThirdPartyConsent = cookie != null && cookie.AllowThirdParty; model.ModalCookieConsent = _privacySettings.ModalCookieConsent; }
public ActionResult SetCookieManagerConsent(CookieManagerModel model) { if (model.AcceptAll) { model.AnalyticsConsent = true; model.ThirdPartyConsent = true; } _cookieConsentManager.SetConsentCookie(model.AnalyticsConsent, model.ThirdPartyConsent); if (!HttpContext.Request.IsAjaxRequest()) { return(RedirectToReferrer()); } return(Json(new { Success = true })); }