remove cookie consent from templates

This commit is contained in:
Isaac Levin 2019-06-04 11:03:09 -04:00
parent d1b9d14eef
commit 4298f63b2a
9 changed files with 0 additions and 120 deletions

View File

@ -1,25 +0,0 @@
@using Microsoft.AspNetCore.Http.Features
@{
var consentFeature = Context.Features.Get<ITrackingConsentFeature>();
var showBanner = !consentFeature?.CanTrack ?? false;
var cookieString = consentFeature?.CreateConsentCookie();
}
@if (showBanner)
{
<div id="cookieConsent" class="alert alert-info alert-dismissible fade show" role="alert">
Use this space to summarize your privacy and cookie use policy. <a class="alert-link" asp-page="/Privacy">Learn More</a>.
<button type="button" class="accept-policy close" data-dismiss="alert" aria-label="Close" data-cookie-string="@cookieString">
<span aria-hidden="true">Accept</span>
</button>
</div>
<script>
(function () {
var button = document.querySelector("#cookieConsent button[data-cookie-string]");
button.addEventListener("click", function (event) {
document.cookie = button.dataset.cookieString;
}, false);
})();
</script>
}

View File

@ -34,12 +34,6 @@
</div>
</nav>
</header>
<div class="container">
<partial name="_CookieConsentPartial" />
<main role="main" class="pb-3">
@RenderBody()
</main>
</div>
<footer class="border-top footer text-muted">
<div class="container">

View File

@ -52,11 +52,6 @@ namespace Company.WebApplication1
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.Configure<CookiePolicyOptions>(options =>
{
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
options.CheckConsentNeeded = context => true;
});
#if (IndividualLocalAuth)
services.AddDbContext<ApplicationDbContext>(options =>
@ -152,8 +147,6 @@ namespace Company.WebApplication1
#endif
app.UseStaticFiles();
app.UseCookiePolicy();
app.UseRouting();
#if (OrganizationalAuth || IndividualAuth)

View File

@ -52,11 +52,6 @@ namespace Company.WebApplication1
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.Configure<CookiePolicyOptions>(options =>
{
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
options.CheckConsentNeeded = context => true;
});
#if (IndividualLocalAuth)
services.AddDbContext<ApplicationDbContext>(options =>
@ -153,8 +148,6 @@ namespace Company.WebApplication1
#endif
app.UseStaticFiles();
app.UseCookiePolicy();
app.UseRouting();
#if (OrganizationalAuth || IndividualAuth)

View File

@ -1,25 +0,0 @@
@using Microsoft.AspNetCore.Http.Features
@{
var consentFeature = Context.Features.Get<ITrackingConsentFeature>();
var showBanner = !consentFeature?.CanTrack ?? false;
var cookieString = consentFeature?.CreateConsentCookie();
}
@if (showBanner)
{
<div id="cookieConsent" class="alert alert-info alert-dismissible fade show" role="alert">
Use this space to summarize your privacy and cookie use policy. <a class="alert-link" asp-area="" asp-controller="Home" asp-action="Privacy">Learn More</a>.
<button type="button" class="accept-policy close" data-dismiss="alert" aria-label="Close" data-cookie-string="@cookieString">
<span aria-hidden="true">Accept</span>
</button>
</div>
<script>
(function () {
var button = document.querySelector("#cookieConsent button[data-cookie-string]");
button.addEventListener("click", function (event) {
document.cookie = button.dataset.cookieString;
}, false);
})();
</script>
}

View File

@ -34,12 +34,6 @@
</div>
</nav>
</header>
<div class="container">
<partial name="_CookieConsentPartial" />
<main role="main" class="pb-3">
@RenderBody()
</main>
</div>
<footer class="border-top footer text-muted">
<div class="container">

View File

@ -1,25 +0,0 @@
@using Microsoft.AspNetCore.Http.Features
@{
var consentFeature = Context.Features.Get<ITrackingConsentFeature>();
var showBanner = !consentFeature?.CanTrack ?? false;
var cookieString = consentFeature?.CreateConsentCookie();
}
@if (showBanner)
{
<div id="cookieConsent" class="alert alert-info alert-dismissible fade show" role="alert">
Use this space to summarize your privacy and cookie use policy. <a class="alert-link" asp-page="/Privacy">Learn More</a>.
<button type="button" class="accept-policy close" data-dismiss="alert" aria-label="Close" data-cookie-string="@cookieString">
<span aria-hidden="true">Accept</span>
</button>
</div>
<script>
(function () {
var button = document.querySelector("#cookieConsent button[data-cookie-string]");
button.addEventListener("click", function (event) {
document.cookie = button.dataset.cookieString;
}, false);
})();
</script>
}

View File

@ -30,12 +30,6 @@
</div>
</nav>
</header>
<div class="container">
<partial name="_CookieConsentPartial" />
<main role="main" class="pb-3">
@RenderBody()
</main>
</div>
<footer class="border-top footer text-muted">
<div class="container">

View File

@ -22,7 +22,6 @@
"Pages/Privacy.cshtml.cs",
"Pages/_ViewImports.cshtml",
"Pages/_ViewStart.cshtml",
"Pages/Shared/_CookieConsentPartial.cshtml",
"Pages/Shared/_Layout.cshtml",
"Pages/Shared/_LoginPartial.cshtml",
"Pages/Shared/_ValidationScriptsPartial.cshtml",
@ -82,7 +81,6 @@
"Pages/Privacy.cshtml.cs",
"Pages/_ViewImports.cshtml",
"Pages/_ViewStart.cshtml",
"Pages/Shared/_CookieConsentPartial.cshtml",
"Pages/Shared/_Layout.cshtml",
"Pages/Shared/_ValidationScriptsPartial.cshtml",
"Properties/launchSettings.json",
@ -141,7 +139,6 @@
"Pages/Privacy.cshtml.cs",
"Pages/_ViewImports.cshtml",
"Pages/_ViewStart.cshtml",
"Pages/Shared/_CookieConsentPartial.cshtml",
"Pages/Shared/_Layout.cshtml",
"Pages/Shared/_LoginPartial.cshtml",
"Pages/Shared/_ValidationScriptsPartial.cshtml",
@ -201,7 +198,6 @@
"Pages/Privacy.cshtml.cs",
"Pages/_ViewImports.cshtml",
"Pages/_ViewStart.cshtml",
"Pages/Shared/_CookieConsentPartial.cshtml",
"Pages/Shared/_Layout.cshtml",
"Pages/Shared/_LoginPartial.cshtml",
"Pages/Shared/_ValidationScriptsPartial.cshtml",
@ -261,7 +257,6 @@
"Pages/Privacy.cshtml.cs",
"Pages/_ViewImports.cshtml",
"Pages/_ViewStart.cshtml",
"Pages/Shared/_CookieConsentPartial.cshtml",
"Pages/Shared/_Layout.cshtml",
"Pages/Shared/_ValidationScriptsPartial.cshtml",
"Properties/launchSettings.json",
@ -320,7 +315,6 @@
"Pages/Privacy.cshtml.cs",
"Pages/_ViewImports.cshtml",
"Pages/_ViewStart.cshtml",
"Pages/Shared/_CookieConsentPartial.cshtml",
"Pages/Shared/_Layout.cshtml",
"Pages/Shared/_LoginPartial.cshtml",
"Pages/Shared/_ValidationScriptsPartial.cshtml",
@ -484,7 +478,6 @@
"Views/Home/Index.cshtml",
"Views/Home/Privacy.cshtml",
"Views/Shared/Error.cshtml",
"Views/Shared/_CookieConsentPartial.cshtml",
"Views/Shared/_Layout.cshtml",
"Views/Shared/_LoginPartial.cshtml",
"Views/Shared/_ValidationScriptsPartial.cshtml",
@ -543,7 +536,6 @@
"Views/Home/Index.cshtml",
"Views/Home/Privacy.cshtml",
"Views/Shared/Error.cshtml",
"Views/Shared/_CookieConsentPartial.cshtml",
"Views/Shared/_Layout.cshtml",
"Views/Shared/_ValidationScriptsPartial.cshtml",
"wwwroot/favicon.ico",
@ -601,7 +593,6 @@
"Views/Home/Index.cshtml",
"Views/Home/Privacy.cshtml",
"Views/Shared/Error.cshtml",
"Views/Shared/_CookieConsentPartial.cshtml",
"Views/Shared/_Layout.cshtml",
"Views/Shared/_LoginPartial.cshtml",
"Views/Shared/_ValidationScriptsPartial.cshtml",
@ -660,7 +651,6 @@
"Views/Home/Index.cshtml",
"Views/Home/Privacy.cshtml",
"Views/Shared/Error.cshtml",
"Views/Shared/_CookieConsentPartial.cshtml",
"Views/Shared/_Layout.cshtml",
"Views/Shared/_LoginPartial.cshtml",
"Views/Shared/_ValidationScriptsPartial.cshtml",
@ -719,7 +709,6 @@
"Views/Home/Index.cshtml",
"Views/Home/Privacy.cshtml",
"Views/Shared/Error.cshtml",
"Views/Shared/_CookieConsentPartial.cshtml",
"Views/Shared/_Layout.cshtml",
"Views/Shared/_ValidationScriptsPartial.cshtml",
"wwwroot/favicon.ico",
@ -777,7 +766,6 @@
"Views/Home/Index.cshtml",
"Views/Home/Privacy.cshtml",
"Views/Shared/Error.cshtml",
"Views/Shared/_CookieConsentPartial.cshtml",
"Views/Shared/_Layout.cshtml",
"Views/Shared/_LoginPartial.cshtml",
"Views/Shared/_ValidationScriptsPartial.cshtml",
@ -836,7 +824,6 @@
"Views/Home/Index.cshtml",
"Views/Home/Privacy.cshtml",
"Views/Shared/Error.cshtml",
"Views/Shared/_CookieConsentPartial.cshtml",
"Views/Shared/_Layout.cshtml",
"Views/Shared/_ValidationScriptsPartial.cshtml",
"wwwroot/favicon.ico",