Skip to content

Commit

Permalink
Merge pull request #676 from DFE-Digital/misc-changes-from-archival-o…
Browse files Browse the repository at this point in the history
…f-no-access

Misc changes from archival of no access
  • Loading branch information
dynamictulip authored Dec 20, 2024
2 parents f903bd3 + f7cf20d commit cc2d798
Show file tree
Hide file tree
Showing 19 changed files with 287 additions and 252 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased][unreleased]

### Changed
- Fix Privacy page having incorrect width
- Update name of cookie consent cookie to be consistent with application name and what is displayed in the Cookie UI

## [Release-18][release-18] (production-2024-12-19.4567)

### Added
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Security.Claims;
using DfE.FindInformationAcademiesTrusts.Extensions;
using DfE.FindInformationAcademiesTrusts.Options;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Authorization.Infrastructure;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace DfE.FindInformationAcademiesTrusts.Configuration;

public static class FiatCookies
{
public const string Antiforgery = ".FindInformationAcademiesTrusts.Antiforgery";
public const string CookieConsent = ".FindInformationAcademiesTrusts.CookieConsent";
public const string Login = ".FindInformationAcademiesTrusts.Login";
}
10 changes: 5 additions & 5 deletions DfE.FindInformationAcademiesTrusts/CookiesHelper.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using DfE.FindInformationAcademiesTrusts.Configuration;
using Microsoft.AspNetCore.Mvc.ViewFeatures;

namespace DfE.FindInformationAcademiesTrusts;

public static class CookiesHelper
{
public const string ConsentCookieName = ".FindInformationAcademiesTrust.CookieConsent";
public const string DeleteCookieTempDataName = "DeleteCookie";
public const string CookieChangedTempDataName = "CookieResponse";
public const string ReturnPathQuery = "returnPath";
Expand All @@ -22,8 +22,8 @@ public static bool OptionalCookiesAreAccepted(HttpContext context, ITempDataDict
return false;
}

return context.Request.Cookies.ContainsKey(ConsentCookieName) &&
bool.Parse(context.Request.Cookies[ConsentCookieName]!);
return context.Request.Cookies.ContainsKey(FiatCookies.CookieConsent) &&
bool.Parse(context.Request.Cookies[FiatCookies.CookieConsent]!);
}

public static string ReturnPath(HttpContext context)
Expand All @@ -35,7 +35,7 @@ public static string ReturnPath(HttpContext context)

public static bool ShowCookieBanner(HttpContext context, ITempDataDictionary tempData)
{
return !context.Request.Cookies.ContainsKey(ConsentCookieName) &&
return !context.Request.Cookies.ContainsKey(FiatCookies.CookieConsent) &&
tempData[DeleteCookieTempDataName] is null;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace DfE.FindInformationAcademiesTrusts;
namespace DfE.FindInformationAcademiesTrusts.Extensions;

public static class EnvironmentExtensions
{
Expand Down
277 changes: 139 additions & 138 deletions DfE.FindInformationAcademiesTrusts/Pages/Cookies.cshtml
Original file line number Diff line number Diff line change
@@ -1,157 +1,158 @@
@page
@using DfE.FindInformationAcademiesTrusts.Configuration
@model CookiesModel

@{
Layout = "_ContentLayout";
ViewData["Title"] = "Cookies";
Layout = "_ContentLayout";
ViewData["Title"] = "Cookies";
}

@if (Model.DisplayCookieChangedMessageOnCookiesPage)
{
<div class="govuk-notification-banner govuk-notification-banner--success" role="alert" aria-labelledby="govuk-notification-banner-title" data-module="govuk-notification-banner">
<div class="govuk-notification-banner__header">
<h2 class="govuk-notification-banner__title" id="govuk-notification-banner-title">
Success
</h2>
</div>
<div class="govuk-notification-banner__content">
<p class="govuk-notification-banner__heading">
Youve set your cookie preferences. <a class="govuk-notification-banner__link" href="@Model.ReturnPath" data-testid="return-to-previous-page">Go back to the page you were looking at</a>.
</p>
</div>
<div class="govuk-notification-banner govuk-notification-banner--success" role="alert" aria-labelledby="govuk-notification-banner-title" data-module="govuk-notification-banner">
<div class="govuk-notification-banner__header">
<h2 class="govuk-notification-banner__title" id="govuk-notification-banner-title">
Success
</h2>
</div>
<div class="govuk-notification-banner__content">
<p class="govuk-notification-banner__heading">
Youve set your cookie preferences. <a class="govuk-notification-banner__link" href="@Model.ReturnPath" data-testid="return-to-previous-page">Go back to the page you were looking at</a>.
</p>
</div>
</div>
}

<h1 class="govuk-heading-l">Cookie preferences</h1>
<div class="govuk-grid-row">
<div class="govuk-grid-column-three-quarters">
<p class="govuk-body">
Cookies are small files saved on your phone, tablet or computer when you visit a website.
</p>
<p class="govuk-body">
We use cookies to make Find information about academies and trusts work and collect information about how you use our service.
</p>
<h2 class="govuk-heading-m">Essential cookies</h2>
<p class="govuk-body">
Essential cookies keep your information secure while you use this site. We do not need to ask permission to use them.
</p>
<table class="govuk-table" aria-label="Essential cookies">
<thead class="govuk-table__header">
<tr>
<th class="govuk-table__header">Name</th>
<th class="govuk-table__header">Purpose</th>
<th class="govuk-table__header">Expires</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr>
<td class="govuk-table__cell">.FindInformationAcademiesTrusts.Login</td>
<td class="govuk-table__cell">Used to keep you signed in</td>
<td class="govuk-table__cell">With browser settings (Session)</td>
</tr>
<tr>
<td class="govuk-table__cell">.FindInformationAcademiesTrusts.CookieConsent </td>
<td class="govuk-table__cell">Stores your consent to optional cookies </td>
<td class="govuk-table__cell">1 year</td>
</tr>
<tr>
<td class="govuk-table__cell">ASLBSA </td>
<td class="govuk-table__cell">Used to balance the load on our servers </td>
<td class="govuk-table__cell">With browser settings (Session)</td>
</tr>
<tr>
<td class="govuk-table__cell">ASLBSACORS </td>
<td class="govuk-table__cell">Used to balance the load on our servers </td>
<td class="govuk-table__cell">With browser settings (Session)</td>
</tr>
<tr>
<td class="govuk-table__cell">.FindInformationAcademiesTrusts.Antiforgery </td>
<td class="govuk-table__cell">Secures you and our service against Cross Site Scripting Attacks (CSRF) </td>
<td class="govuk-table__cell">With browser settings (Session)</td>
</tr>
</tbody>
</table>
<div class="govuk-grid-column-three-quarters">
<p class="govuk-body">
Cookies are small files saved on your phone, tablet or computer when you visit a website.
</p>
<p class="govuk-body">
We use cookies to make Find information about academies and trusts work and collect information about how you use our service.
</p>
<h2 class="govuk-heading-m">Essential cookies</h2>
<p class="govuk-body">
Essential cookies keep your information secure while you use this site. We do not need to ask permission to use them.
</p>
<table class="govuk-table" aria-label="Essential cookies">
<thead class="govuk-table__header">
<tr>
<th class="govuk-table__header">Name</th>
<th class="govuk-table__header">Purpose</th>
<th class="govuk-table__header">Expires</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr>
<td class="govuk-table__cell">@FiatCookies.Login</td>
<td class="govuk-table__cell">Used to keep you signed in</td>
<td class="govuk-table__cell">With browser settings (Session)</td>
</tr>
<tr>
<td class="govuk-table__cell">@FiatCookies.CookieConsent</td>
<td class="govuk-table__cell">Stores your consent to optional cookies </td>
<td class="govuk-table__cell">1 year</td>
</tr>
<tr>
<td class="govuk-table__cell">ASLBSA </td>
<td class="govuk-table__cell">Used to balance the load on our servers </td>
<td class="govuk-table__cell">With browser settings (Session)</td>
</tr>
<tr>
<td class="govuk-table__cell">ASLBSACORS </td>
<td class="govuk-table__cell">Used to balance the load on our servers </td>
<td class="govuk-table__cell">With browser settings (Session)</td>
</tr>
<tr>
<td class="govuk-table__cell">@FiatCookies.Antiforgery</td>
<td class="govuk-table__cell">Secures you and our service against Cross Site Scripting Attacks (CSRF) </td>
<td class="govuk-table__cell">With browser settings (Session)</td>
</tr>
</tbody>
</table>

<h2 class="govuk-heading-m">Optional analytics cookies</h2>
<p class="govuk-body">
With your permission, we use Application Insights and Google Analytics to collect data about how you use this site. This information helps us to improve our service.
</p>
<p class="govuk-body">
Application Insights and Google Analytics are not allowed to use or share our analytics data with anyone. Application Insights and Google Analytics store information about:
</p>
<ul class="govuk-list govuk-list--bullet">
<li>how you got to this site</li>
<li>the pages you visit on this site and how long you spend on them</li>
<li>any errors you see while using this site</li>
<li>what you click on while you are visiting the site</li>
<li>whether you’ve visited before</li>
<li>your unique user identity</li>
</ul>
<h2 class="govuk-heading-m">Optional analytics cookies</h2>
<p class="govuk-body">
With your permission, we use Application Insights and Google Analytics to collect data about how you use this site. This information helps us to improve our service.
</p>
<p class="govuk-body">
Application Insights and Google Analytics are not allowed to use or share our analytics data with anyone. Application Insights and Google Analytics store information about:
</p>
<ul class="govuk-list govuk-list--bullet">
<li>how you got to this site</li>
<li>the pages you visit on this site and how long you spend on them</li>
<li>any errors you see while using this site</li>
<li>what you click on while you are visiting the site</li>
<li>whether you’ve visited before</li>
<li>your unique user identity</li>
</ul>

<table class="govuk-table" aria-label="Essential cookies">
<thead class="govuk-table__header">
<tr>
<th class="govuk-table__header">Name</th>
<th class="govuk-table__header">Purpose</th>
<th class="govuk-table__header">Expires</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr>
<td class="govuk-table__cell">ai_user</td>
<td class="govuk-table__cell">Checks if you have visited this site before. This helps us count how many people visit our site.</td>
<td class="govuk-table__cell">1 year</td>
</tr>
<tr>
<td class="govuk-table__cell">ai_session</td>
<td class="govuk-table__cell">Checks if you have visited this site before. This helps us count how many people visit our site.</td>
<td class="govuk-table__cell">30 minutes</td>
</tr>
<tr class="govuk-table__row">
<td class="govuk-table__cell">ai_authUser</td>
<td class="govuk-table__cell">This helps us to identify authenticated users and how they interact with the site</td>
<td class="govuk-table__cell">When you close your browser</td>
</tr>
<tr>
<td class="govuk-table__cell">_ga</td>
<td class="govuk-table__cell">Tracks your activity on the site. This helps us to improve our service.</td>
<td class="govuk-table__cell">2 years</td>
</tr>
<tr>
<td class="govuk-table__cell">_gid</td>
<td class="govuk-table__cell">Tracks a number of users. This helps us determine patterns in behaviour.</td>
<td class="govuk-table__cell">24 hours</td>
</tr>
</tbody>
</table>
</div>
<table class="govuk-table" aria-label="Essential cookies">
<thead class="govuk-table__header">
<tr>
<th class="govuk-table__header">Name</th>
<th class="govuk-table__header">Purpose</th>
<th class="govuk-table__header">Expires</th>
</tr>
</thead>
<tbody class="govuk-table__body">
<tr>
<td class="govuk-table__cell">ai_user</td>
<td class="govuk-table__cell">Checks if you have visited this site before. This helps us count how many people visit our site.</td>
<td class="govuk-table__cell">1 year</td>
</tr>
<tr>
<td class="govuk-table__cell">ai_session</td>
<td class="govuk-table__cell">Checks if you have visited this site before. This helps us count how many people visit our site.</td>
<td class="govuk-table__cell">30 minutes</td>
</tr>
<tr class="govuk-table__row">
<td class="govuk-table__cell">ai_authUser</td>
<td class="govuk-table__cell">This helps us to identify authenticated users and how they interact with the site</td>
<td class="govuk-table__cell">When you close your browser</td>
</tr>
<tr>
<td class="govuk-table__cell">_ga</td>
<td class="govuk-table__cell">Tracks your activity on the site. This helps us to improve our service.</td>
<td class="govuk-table__cell">2 years</td>
</tr>
<tr>
<td class="govuk-table__cell">_gid</td>
<td class="govuk-table__cell">Tracks a number of users. This helps us determine patterns in behaviour.</td>
<td class="govuk-table__cell">24 hours</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<form method="post" name="frmCookies">
<div class="govuk-form-group">
<input type="hidden" name="redirectPath" value="@(HttpContext.Request.Path + HttpContext.Request.QueryString)"/>
<fieldset class="govuk-fieldset">
<legend class="govuk-fieldset__legend govuk-fieldset__legend--m">
<h3 class="govuk-fieldset__heading">Do you want to accept cookies that measure your website use?</h3>
</legend>
<div class="govuk-radios">
<div class="govuk-radios__item">
<input class="govuk-radios__input" id="cookies-accept" type="radio" name="consent" value="true" checked="@Model.Consent">
<label class="govuk-label govuk-radios__label" for="cookies-accept">
Yes
</label>
</div>
<div class="govuk-radios__item">
<input class="govuk-radios__input" id="cookies-reject" type="radio" name="consent" value="false" checked="@(!Model.Consent)">
<label class="govuk-label govuk-radios__label" for="cookies-reject">
No
</label>
</div>
</div>
</fieldset>
<div class="govuk-grid-column-two-thirds">
<form method="post" name="frmCookies">
<div class="govuk-form-group">
<input type="hidden" name="redirectPath" value="@(HttpContext.Request.Path + HttpContext.Request.QueryString)"/>
<fieldset class="govuk-fieldset">
<legend class="govuk-fieldset__legend govuk-fieldset__legend--m">
<h3 class="govuk-fieldset__heading">Do you want to accept cookies that measure your website use?</h3>
</legend>
<div class="govuk-radios">
<div class="govuk-radios__item">
<input class="govuk-radios__input" id="cookies-accept" type="radio" name="consent" value="true" checked="@Model.Consent">
<label class="govuk-label govuk-radios__label" for="cookies-accept">
Yes
</label>
</div>
<button type="submit" class="govuk-button" data-module="govuk-button" data-testid="save-cookie-preferences-button">Save changes</button>
</form>
</div>
<div class="govuk-radios__item">
<input class="govuk-radios__input" id="cookies-reject" type="radio" name="consent" value="false" checked="@(!Model.Consent)">
<label class="govuk-label govuk-radios__label" for="cookies-reject">
No
</label>
</div>
</div>
</fieldset>
</div>
<button type="submit" class="govuk-button" data-module="govuk-button" data-testid="save-cookie-preferences-button">Save changes</button>
</form>
</div>
</div>
Loading

0 comments on commit cc2d798

Please sign in to comment.