Skip to content

Commit

Permalink
Merge pull request #983 from alphagov/remove-old-cookie-banner
Browse files Browse the repository at this point in the history
Remove the old style "GOV.UK uses cookies to make the site simpler" cookie banner
  • Loading branch information
36degrees authored Feb 3, 2021
2 parents c319242 + 9bf7726 commit 06a458f
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 132 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Unreleased

## Fixes

- [Pull request #983: Remove the old style "GOV.UK uses cookies to make the site simpler" cookie banner](https://github.com/alphagov/govuk-prototype-kit/pull/983)

# 9.11.2 (Patch release)

## Fixes
Expand Down
3 changes: 0 additions & 3 deletions app/assets/sass/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,4 @@ $govuk-assets-path: '/govuk/assets/';
@import "patterns/task-list";
@import "patterns/related-items";

// Components that aren't in Frontend
@import "components/cookie-banner";

// Add extra styles here, or re-organise the Sass files in whichever way makes most sense to you
24 changes: 0 additions & 24 deletions app/assets/sass/components/_cookie-banner.scss

This file was deleted.

3 changes: 0 additions & 3 deletions app/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ module.exports = {
// Force HTTP to redirect to HTTPS on production
useHttps: 'true',

// Cookie warning - update link to service's cookie page.
cookieText: 'GOV.UK uses cookies to make the site simpler. <a href="#">Find out more about cookies</a>',

// Enable or disable Browser Sync
useBrowserSync: 'true'

Expand Down
7 changes: 0 additions & 7 deletions app/views/includes/cookie-banner.html

This file was deleted.

1 change: 0 additions & 1 deletion app/views/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
{% endblock %}

{% block header %}
{% include "includes/cookie-banner.html" %}
{# Set serviceName in config.js. #}
{{ govukHeader({
homepageUrl: "/",
Expand Down
80 changes: 27 additions & 53 deletions docs/views/cookies.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
{% endblock %}

{% block beforeContent %}
{{ govukBreadcrumbs({
items: [
{
text: "GOV.UK Prototype Kit",
href: "/docs"
}
]
}) }}
{{ govukBreadcrumbs({
items: [
{
text: "GOV.UK Prototype Kit",
href: "/docs"
}
]
}) }}
{% endblock %}

{% block content %}
Expand All @@ -25,61 +25,35 @@ <h1 class="govuk-heading-xl">Cookies</h1>

<p>The GOV.UK Prototype Kit puts small files (known as ‘cookies’) on to your computer.</p>

<p>We use cookies to:</p>
<ul class="govuk-list govuk-list--bullet">
<li>record the notifications you&#39;ve seen so we don&#39;t show them again</li>
<li>make prototypes work as well as possible</li>
</ul>
<p>We use cookies to make prototypes work as well as possible.</p>

<p>These cookies aren’t used to identify you personally.</p>

<p>You’ll see a message on the site before we store a cookie on your computer.</p>

<p><a href="https://ico.org.uk/for-the-public/online/cookies/">Find out how to manage cookies</a>.</p>

<h2 class="govuk-heading-l">Our cookie message</h2>

<p>You'll see a message about cookies when you first visit the GOV.UK Prototype Kit. We’ll store a cookie so that your computer knows you’ve seen it and knows not to show it again.</p>

{{ govukTable({
classes: "app-table--fixed",
caption: "Cookies relating to our cookies message",
captionClasses: "govuk-visually-hidden",
head: [
{ text: "Name" },
{ text: "Purpose" },
{ text: "Expires" }
],
rows: [
[
{ text: "seen_cookie_message" },
{ text: "Saves a message to let us know that you've seen our cookie message" },
{ text: "28 days" }
]
]
}) }}

<h2 class="govuk-heading-l">Storing users' answers within prototypes</h2>
<h2 class="govuk-heading-l">Storing users' answers within prototypes</h2>

<p>To help prototypes work as well as possible, each prototype stores a cookie to remember what users select on question pages. This allows prototypes to have branching pages and show users' answers on pages like the 'Check your answers' summary page.</p>
<p>To help prototypes work as well as possible, each prototype stores a cookie to remember what users select on question pages.</p>

<p>This allows prototypes to have branching pages and show users' answers on pages like the 'Check your answers' summary page.</p>

{{ govukTable({
classes: "app-table--fixed",
caption: "Cookies relating to storing users' answers within prototypes",
captionClasses: "govuk-visually-hidden",
head: [
{{ govukTable({
classes: "app-table--fixed",
caption: "Cookies relating to storing users' answers within prototypes",
captionClasses: "govuk-visually-hidden",
head: [
{ text: "Name" },
{ text: "Purpose" },
{ text: "Expires" }
],
rows: [
[
{ text: "govuk-prototype-kit-\<UNIQUE-ID\>" },
{ text: "Storing users' answers from question pages" },
{ text: "4 hours" }
]
]
}) }}
],
rows: [
[
{ text: "govuk-prototype-kit-\<UNIQUE-ID\>" },
{ text: "Storing users' answers from question pages" },
{ text: "4 hours" }
]
]
}) }}

</div>
</div>
Expand Down
7 changes: 0 additions & 7 deletions docs/views/includes/cookie-banner.html

This file was deleted.

1 change: 0 additions & 1 deletion docs/views/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
{% endblock %}

{% block header %}
{% include "includes/cookie-banner.html" %}
{# Set serviceName in config.js. #}
{{ govukHeader({
serviceName: serviceName,
Expand Down
22 changes: 0 additions & 22 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,25 +250,3 @@ exports.autoStoreData = function (req, res, next) {

next()
}

exports.handleCookies = function (app) {
return function handleCookies (req, res, next) {
const COOKIE_NAME = 'seen_cookie_message'
const cookie = req.cookies[COOKIE_NAME]

if (cookie === 'yes') {
app.locals.shouldShowCookieMessage = false
return next()
}

const maxAgeInDays = 28
res.cookie(COOKIE_NAME, 'yes', {
maxAge: maxAgeInDays * 24 * 60 * 60 * 1000,
httpOnly: true
})

app.locals.shouldShowCookieMessage = true

next()
}
}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"body-parser": "^1.14.1",
"browser-sync": "^2.11.1",
"client-sessions": "^0.8.0",
"cookie-parser": "^1.4.5",
"cross-spawn": "^7.0.2",
"del": "^5.1.0",
"dotenv": "^8.2.0",
Expand Down
10 changes: 0 additions & 10 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const express = require('express')
const nunjucks = require('nunjucks')
const sessionInCookie = require('client-sessions')
const sessionInMemory = require('express-session')
const cookieParser = require('cookie-parser')

// Run before other code to make sure variables from .env are available
dotenv.config()
Expand Down Expand Up @@ -45,12 +44,6 @@ if (useV6) {
v6App = express()
}

// Set cookies for use in cookie banner.
app.use(cookieParser())
documentationApp.use(cookieParser())
app.use(utils.handleCookies(app))
documentationApp.use(utils.handleCookies(documentationApp))

// Set up configuration variables
var releaseVersion = packageJson.version
var glitchEnv = (process.env.PROJECT_REMIX_CHAIN) ? 'production' : false // glitch.com
Expand Down Expand Up @@ -162,7 +155,6 @@ if (useV6) {
app.locals.asset_path = '/public/'
app.locals.useAutoStoreData = (useAutoStoreData === 'true')
app.locals.useCookieSessionStore = (useCookieSessionStore === 'true')
app.locals.cookieText = config.cookieText
app.locals.promoMode = promoMode
app.locals.releaseVersion = 'v' + releaseVersion
app.locals.serviceName = config.serviceName
Expand Down Expand Up @@ -216,8 +208,6 @@ app.post('/prototype-admin/clear-data', function (req, res) {
if (promoMode === 'true') {
console.log('Prototype Kit running in promo mode')

app.locals.cookieText = 'GOV.UK uses cookies to make the site simpler. <a href="/docs/cookies">Find out more about cookies</a>'

app.get('/', function (req, res) {
res.redirect('/docs')
})
Expand Down

0 comments on commit 06a458f

Please sign in to comment.